On Mon, Sep 05, 2016 at 08:44:55AM -0700, Stefano Tranquillini wrote: > Hello > > I've a problem syncing the db. > > I run the command: django-admin migrate > > System check identified some issues: > Operations to perform: > Synchronize unmigrated apps: oauth2_provider, <and many more> > Apply all migrations: admin, <and many more>Synchronizing apps without > migrations: > Creating tables... > Running deferred SQL... > Installing custom SQL...Running migrations: > No migrations to apply.Traceback (most recent call last): > File "/Users/stefano/.virtualenvs/prjrest/bin/django-admin", line 11, in > <module> > sys.exit(execute_from_command_line()) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/__init__.py", > line 354, in execute_from_command_line > utility.execute() > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/__init__.py", > line 346, in execute > self.fetch_command(subcommand).run_from_argv(self.argv) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/base.py", > line 394, in run_from_argv > self.execute(*args, **cmd_options) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/base.py", > line 445, in execute > output = self.handle(*args, **options) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/core/management/commands/migrate.py", > line 208, in handle > changes = autodetector.changes(graph=executor.loader.graph) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/db/migrations/autodetector.py", > line 43, in changes > changes = self._detect_changes(convert_apps, graph) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/db/migrations/autodetector.py", > line 165, in _detect_changes > old_field = self.old_apps.get_model(app_label, > old_model_name)._meta.get_field(field_name) > File > "/Users/stefano/.virtualenvs/prjrest/lib/python2.7/site-packages/django/db/models/options.py", > line 554, in get_field > raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, > field_name)) > django.core.exceptions.FieldDoesNotExist: CustomerKey has no field named > u'customer_key_cipher_text' > > So, it seems that there are not migration, but still django complains for a > missing field. > > However in the model the field is there > > > class CustomerKey(models.Model):... > customer_key_cipher_text = Base64Field(default='') > > Any idea on what's the problem?
According to the stack trace, this error happens when the autodetector is trying to get the model field from a previous state of the models, which is determined from the migration history, not the current model definitions. Have you by any chance made any changes to any of the existing migrations? I can imagine that this could happen if one of your migrations tries to make an AlterField operation on a field that hasn't been created in any of the preceding migrations. Good luck, Michal -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160905155543.GJ6601%40koniiiik.org. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Digital signature