There is no such column: django_content_type.name

I had a sandbox with a sandbox for django-oscar deployed on my website at example.com. I wanted to move this to example.com:8000 and run another project on example.com url. I have successfully completed the second part, and when you log on to example.com, you can see the new django project and run it, but the fact is that the first django project, which was the django-oscar sandbox, will not respond correctly.

when you enter example.com:8000, you see the current debug log:

no such column: django_content_type.name Request Method: GET Request URL: http://example.com:8000/fa/ Django Version: 1.7.8 Exception Type: OperationalError Exception Value: no such column: django_content_type.name Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py in execute, line 485 Python Executable: /usr/bin/python Python Version: 2.7.3 Python Path: ['/var/www/setak/setakenv/setakmain/django-oscar/sites/sandbox', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol'] 

Now I was looking for this error, and I did not get any valuable results.

Also, when I run

 sudo python manage.py migrate 

the following happens: I also did not find the correct solution:

 Operations to perform: Synchronize unmigrated apps: reports_dashboard, treebeard, oscar, communications_dashboard, reviews_dashboard, debug_toolbar, widget_tweaks, offers_dashboard, catalogue_dashboard, sitemaps, compressor, django_extensions, dashboard, thumbnail, haystack, ranges_dashboard, checkout, gateway, django_tables2 Apply all migrations: customer, promotions, shipping, wishlists, offer, admin, sessions, contenttypes, auth, payment, reviews, analytics, catalogue, flatpages, sites, address, basket, partner, order, voucher Synchronizing apps without migrations: Creating tables... Installing custom SQL... Installing indexes... Running migrations: No migrations to apply. Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 165, in handle emit_post_migrate_signal(created_models, self.verbosity, self.interactive, connection.alias) File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 268, in emit_post_migrate_signal using=db) File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 198, in send response = receiver(signal=self, sender=sender, **named) File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/management/__init__.py", line 83, in create_permissions ctype = ContentType.objects.db_manager(using).get_for_model(klass) File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py", line 58, in get_for_model " is migrated before trying to migrate apps individually." RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually. 

update 1: I also use django 1.7.8 for this.

update 2: I changed my version of Django to 1.8.1, the makemigrations and migrate commands worked. Then I started the server again, and now I get this error in my log: (I also deleted the apache settings, as they were irrelevant!)

 Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__ return self.application(environ, start_response) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 170, in __call__ self.load_middleware() File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 50, in load_middleware mw_class = import_string(middleware_path) File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 26, in import_string module = import_module(module_path) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) ImportError: No module named transaction 
+8
python django apache django-oscar
source share
2 answers

I could finally solve my problem. The problem was that I used django 1.8 to run manage.py migrate , and the project was developed under django 1.7.1, so the migrations turned the situation around.

So what I did was that I installed django 1.8.1 again, ran manage.py migrate contenttypes 0001 , then uninstalled django 1.8.1, installed django 1.7.8 and ran manage.py runserver and everything manage.py runserver back to normal condition and worked great.

+15
source share

I had the same problem. In my case I used Django 1.10 to create my local database, but I need to use the old version of Django (1.7) to run some tests, so I deleted my local database and ran manage.py migrate with Django 1.7, after which the error went away .

Alternatively, instead of deleting the local database, you can save and return the database to the project when necessary, when the project is executed using Django 1.10

0
source share

All Articles