I get the folling problem when I try to run python2.7 manage.py syncdb on webfaction. Apologies if I am not providing the right info as I am very new to this.
Creating table carts_cartitem
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 533, in handle
return self.handle_noargs(**options)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/commands/syncdb.py", line 27, in handle_noargs
call_command("migrate", **options)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 115, in call_command
return klass.execute(*args, **defaults)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/commands/migrate.py", line 128, in handle
created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/core/management/commands/migrate.py", line 239, in sync_apps
cursor.execute(statement)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/db/backends/utils.py", line 63, in execute
return self.cursor.execute(sql)
File "/home/user/webapps/myproject/lib/python2.7/Django-1.7.1-py2.7.egg/django/db/backends/mysql/base.py", line 128, in execute
return self.cursor.execute(query, args)
File "/usr/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1426, "Too big precision 1000 specified for column 'line_total'. Maximum is 65.")
Please excuse my lack of knowledge here, I seemed to have solved this by running python manage.py migrate --fake and now I am no longer getting any of the previous errors.
Related
When I try to run: python3 manage.py createdb
after I add my password I get an error, after the superuser create successfully. and the finish of the following error is :
django.db.utils.OperationalError: Problem installing fixtures: no such table: pages_page__old
The full error :
Traceback (most recent call last):
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 326, in execute
return Database.Cursor.execute(self, query)
sqlite3.OperationalError: no such table: pages_page__old
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/martaf/Travail_insPYration/shop/manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/mezzanine/core/management/commands/createdb.py", line 61, in handle
func()
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/mezzanine/core/management/commands/createdb.py", line 109, in create_pages
call_command("loaddata", "mezzanine_required.json")
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/commands/loaddata.py", line 69, in handle
self.loaddata(fixture_labels)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/core/management/commands/loaddata.py", line 115, in loaddata
connection.check_constraints(table_names=table_names)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 276, in check_constraints
cursor.execute(
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
File "/home/martaf/Travail_insPYration/shop/env/lib64/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 326, in execute
return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: Problem installing fixtures: no such table: pages_page__old
I am starting with Django and I got this problem. I understand only that there is a problem with database. I would really like to get some help. Thank you, If it is important I use Fedora 33
Guys really, not my bad that the 90% of problem is code, let me as a question XD
(project_venv) [mikolajwojtowicz#localhost src]$ python3 manage.py makemigrations
Traceback (most recent call last):
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 411, in execute
return Database.Cursor.execute(self, query)
sqlite3.DatabaseError: file is not a database
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/mikolajwojtowicz/Django/my_project/src/manage.py", line 22, in <module>
main()
File "/home/mikolajwojtowicz/Django/my_project/src/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/core/management/commands/makemigrations.py", line 101, in handle
loader.check_consistent_history(connection)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/migrations/loader.py", line 290, in check_consistent_history
applied = recorder.applied_migrations()
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations
if self.has_table():
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/migrations/recorder.py", line 56, in has_table
tables = self.connection.introspection.table_names(cursor)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/base/introspection.py", line 48, in table_names
return get_names(cursor)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/base/introspection.py", line 43, in get_names
return sorted(ti.name for ti in self.get_table_list(cursor)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/sqlite3/introspection.py", line 74, in get_table_list
cursor.execute("""
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
return super().execute(sql, params)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/utils.py", line 82, in _execute
return self.cursor.execute(sql)
File "/home/mikolajwojtowicz/.local/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 411, in execute
return Database.Cursor.execute(self, query)
django.db.utils.DatabaseError: file is not a database
The error log says:
sqlite3.DatabaseError: file is not a database
This means that your settings for the database are wrong. This setting is located in the settings.py in your core project's directory (this directory will also have wsgi.py and asgi.py)
Make sure your settings for db engine, name, user, and password are correct
I'm trying to make a webpage using python and mezzanine as its cms.
but I got this error after successfully creating Superuser:
Superuser created successfully.
Traceback (most recent call last):
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 326, in execute
return Database.Cursor.execute(self, query)
sqlite3.OperationalError: no such table: django_site__old
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\annie\Documents\DMCproject\manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "C:\Python39\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Python39\lib\site-packages\django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python39\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python39\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Python39\lib\site-packages\mezzanine\core\management\commands\createdb.py", line 61, in handle
func()
File "C:\Python39\lib\site-packages\mezzanine\core\management\commands\createdb.py", line 109, in create_pages
call_command("loaddata", "mezzanine_required.json")
File "C:\Python39\lib\site-packages\django\core\management\__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "C:\Python39\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Python39\lib\site-packages\django\core\management\commands\loaddata.py", line 69, in handle
self.loaddata(fixture_labels)
File "C:\Python39\lib\site-packages\django\core\management\commands\loaddata.py", line 115, in loaddata
connection.check_constraints(table_names=table_names)
File "C:\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 276, in check_constraints
cursor.execute(
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Python39\lib\site-packages\django\db\utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Python39\lib\site-packages\django\utils\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Python39\lib\site-packages\django\db\backends\utils.py", line 62, in execute
return self.cursor.execute(sql)
File "C:\Python39\lib\site-packages\django\db\backends\sqlite3\base.py", line 326, in execute
return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: Problem installing fixtures: no such table: django_site__old
This is related to this issue in Django: https://code.djangoproject.com/ticket/29182.
It is caused by a new behavior introduced in sqlite 3.26.
Django has patched it in latest 2.0 and 2.1, but mezzanine does not support Django 2 yet.
The easiest fix is to not use sqlite - switch to postgres, mysql, etc. Alternatively, downgrade sqlite to < 3.26
https://github.com/stephenmcd/mezzanine/issues/1910
I had the same issue in a github action and I had to tweak the ubuntu version to get the preinstalled sqlite version that would work. What fixed the issue for me was to change this line:
runs-on: ubuntu-latest
to
runs-on: ubuntu-18.04
Got the ubuntu version containing the sqlite version I needed here: https://packages.ubuntu.com/search?keywords=sqlite3.
I upgraded my django version from 1.7.5 to 1.9.2. All migration ran but when i run tests i get below error.
django.db.utils.ProgrammingError: relation "django_content_type" does not exist
I checked the database and the django_content_type model exists. I am using PostgreSQL.
I am only getting this error on PostgreSQL not in Sqlite3..
Traceback
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_test_manage.py", line 129, in
utility.execute()
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_test_manage.py", line 104, in execute
PycharmTestCommand().run_from_argv(self.argv)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_test_manage.py", line 91, in handle
failures = TestRunner(test_labels, verbosity=verbosity, interactive=interactive, failfast=failfast, keepdb='--keepdb' in sys.argv)
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_test_runner.py", line 256, in run_tests
extra_tests=extra_tests, **options)
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_test_runner.py", line 156, in run_tests
return super(DjangoTeamcityTestRunner, self).run_tests(test_labels, extra_tests, **kwargs)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/test/runner.py", line 532, in run_tests
old_config = self.setup_databases()
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/test/runner.py", line 482, in setup_databases
self.parallel, **kwargs
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/test/runner.py", line 726, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 70, in create_test_db
run_syncdb=True,
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/__init__.py", line 119, in call_command
return command.execute(*args, **defaults)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 172, in handle
self.sync_apps(connection, executor.loader.unmigrated_apps)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 293, in sync_apps
cursor.execute(statement)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/Mac/my_env_test/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "django_content_type" does not exist
I used uuid field and JSON field in old Django version but in new version these fields are default provided by django models. So i replaced these fields with django default fields and created migrations again....
Now Its working without any issue..
I try to install django in my mac pro and I finished installing but when I want to run this command :
python manage.py runserver
Stack Feedback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/base.py", line 393, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/commands/syncdb.py", line 25, in handle
call_command("migrate", **options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/base.py", line 444, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/core/management/commands/migrate.py", line 93, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/executor.py", line 19, in __init__
self.loader = MigrationLoader(self.connection)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/loader.py", line 47, in __init__
self.build_graph()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/loader.py", line 182, in build_graph
self.applied_migrations = recorder.applied_migrations()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/recorder.py", line 59, in applied_migrations
self.ensure_schema()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/migrations/recorder.py", line 49, in ensure_schema
if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 135, in _cursor
self.ensure_connection()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/base/base.py", line 119, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python2.7/site-packages/Django-1.8.4-py2.7.egg/django/db/backends/sqlite3/base.py", line 204, in get_new_connection
conn = Database.connect(**conn_params)
django.db.utils.OperationalError: unable to open database file
I then tried my sqlite3 in the python, it works.
So I wanna how can I do it?