Little trouble with migration.

50 views
Skip to first unread message

Алексей Широков

unread,
May 7, 2015, 9:39:16 AM5/7/15
to django...@googlegroups.com
I have custom user model.

settings.py
-----------
...
AUTH_USER_MODEL = 'account.User'
...


also I have following AppConfig

account/apps.py
---------------

class AccountConfig(AppConfig):
    name = 'isar.account'
    label = 'Account'
    verbose_name = 'Аккаунт'


and when I call command migrate I get the following exception:

...
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
  return command.execute(*args, **defaults)
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
  output = self.handle(*args, **options)
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle
  executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
  self.loader = MigrationLoader(self.connection)
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
  self.build_graph()
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 287, in build_graph
  parent = self.check_key(parent, key[0])
File "/var/venvs/isar-future/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 165, in check_key
  raise ValueError("Dependency on unknown app: %s" % key[0])
ValueError: Dependency on unknown app: account

I think that the problem here https://github.com/django/django/blob/stable/1.8.x/django/db/migrations/migration.py#L178

SK

unread,
May 7, 2015, 11:32:09 AM5/7/15
to django...@googlegroups.com
you have added to the installed_apps?

четверг, 7 мая 2015 г., 12:39:16 UTC+3 пользователь Алексей Широков написал:

Алексей Широков

unread,
May 7, 2015, 11:47:41 AM5/7/15
to django...@googlegroups.com
Oh, sure!

INSTALLED_APPS = [
  ...
  'isar.account',
  'isar.account.auth',
  ...
]

Markus Holtermann

unread,
May 7, 2015, 1:03:31 PM5/7/15
to django...@googlegroups.com
Hey there,

app labels (i.e. what you specify in your AppConfig or in AUTH_USER_MODEL) are case sensitive. Thus either change AccountConfig.label to "account" (this affects all migrations that depend on your account app) or AUTH_USER_MODEL to "Account.User". I'd recommend to use lower case app labels

/Markus

Алексей Широков

unread,
May 7, 2015, 1:24:47 PM5/7/15
to django...@googlegroups.com
Oh thank you very much for the clarification.
I understood in what there was a mistake. And
I apologize for my carelessness.

Thanks!

Markus Holtermann

unread,
May 7, 2015, 1:56:57 PM5/7/15
to django...@googlegroups.com
No need to apologize. If you think there is anything we can / should add to Django's documentation that would have either helped you to figure out the issue or that had prevented you from running into the issue in the first place, please go ahead and open an issue at https://code.djangoproject.com/ 

/Markus
Reply all
Reply to author
Forward
0 new messages