Wednesday, April 29, 2015

Re: "RuntimeError: Error creating new content types."

Facing the same problem. Any leads..??

On Saturday, April 18, 2015 at 2:38:56 AM UTC+5:30, Christophe Pettus wrote:
Well, django_content_type.name definitely in my database. :)  This is a project that was migrated from 1.6.

The underlying exception was a null value complaint about django_content_type.name; it appears as though (on the production database) it thought that the migration to remove had been applied, but in fact had not been.

On Apr 17, 2015, at 1:25 PM, Tim Graham <timog...@gmail.com> wrote:

> The contenttypes name column was removed in Django 1.8. Could you retrieve the underlying exception before the RuntimeError is raised?
>
> On Friday, April 17, 2015 at 2:55:07 PM UTC-4, Christophe Pettus wrote:
> Digging into this a bit more, the specific exception is that it is trying to insert a contenttypes row with a null 'name' value.
>
> The code in question is doing a get_or_create() on the contenttype object.  I assume it should be picking up the name from the name @property on the ContentType model, but I don't see that ever actually being called.
>
>
> On Apr 17, 2015, at 11:24 AM, Christophe Pettus <x...@thebuild.com> wrote:
>
> > On Django 1.8, I'm encountering this error when attempting to apply migrations on the production system.  What's interesting is that it works fine on the dev system, and inspecting the django_migrations table, I don't see any (meaningful) differences between them (error text below).
> >
> > There was a model added to the "catalog" application which is not being created in django_content_type.
> >
> > Manually migrating contenttypes individually generates the same error.
> >
> > --
> >
> > $ python manage.py migrate
> > Operations to perform:
> >  Synchronize unmigrated apps: staticfiles, util, treebeard, messages, office
> >  Apply all migrations: info, customers, sessions, admin, contenttypes, auth, sites, catalog, coming_soon, orders
> > Synchronizing apps without migrations:
> >  Creating tables...
> >    Running deferred SQL...
> >  Installing custom SQL...
> > Running migrations:
> >  Rendering model states... DONE
> >  Applying auth.0006_require_contenttypes_0002... OK
> > Traceback (most recent call last):
> >  File "manage.py", line 10, in <module>
> >    execute_from_command_line(sys.argv)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
> >    utility.execute()
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
> >    self.fetch_command(subcommand).run_from_argv(self.argv)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
> >    self.execute(*args, **cmd_options)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
> >    output = self.handle(*args, **options)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 225, in handle
> >    emit_post_migrate_signal(created_models, self.verbosity, self.interactive, connection.alias)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/core/management/sql.py", line 280, in emit_post_migrate_signal
> >    using=db)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 201, in send
> >    response = receiver(signal=self, sender=sender, **named)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 82, in create_permissions
> >    ctype = ContentType.objects.db_manager(using).get_for_model(klass)
> >  File "/home/tbc/environments/fugu/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 78, in get_for_model
> >    "Error creating new content types. Please make sure contenttypes "
> > RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.
> > --
> > -- Christophe Pettus
> >   x...@thebuild.com
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> > To post to this group, send email to django...@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/84FEBC7D-9A57-47FA-9429-A834A2F03021%40thebuild.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> -- Christophe Pettus
>    x...@thebuild.com
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/188d28af-be58-4886-9b89-a8aa410e0114%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
-- Christophe Pettus
   x...@thebuild.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/64f4cd42-a64b-4fe1-860b-2c8de5da45a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment