Reputation: 402
I'm trying to run manage.py runserver or manage.py makemigrations, but I'm getting an error when I do. The error is: ValueError: Dependency on unknown app: backend.
Here's the full error message:
Benjamins-MacBook-Pro:package-backend benhsu$ python3 manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/core/management/commands/makemigrations.py", line 57, in handle
loader = MigrationLoader(None, ignore_no_migrations=True)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/db/migrations/loader.py", line 48, in __init__
self.build_graph()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/db/migrations/loader.py", line 243, in build_graph
parent = self.check_key(parent, key[0])
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/db/migrations/loader.py", line 168, in check_key
raise ValueError("Dependency on unknown app: %s" % key[0])
ValueError: Dependency on unknown app: backend
"backend" is the app I'm working on, and you can see in my folder that it exists. Here's my folder structure:
Here's the relevant part of my settings.py file:
# Application definition
AUTH_USER_MODEL = 'backend.User'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'backend'
)
I don't understand why it's not working since the backend app exists in my folder.
I'd appreciate any help!
Upvotes: 4
Views: 3953
Reputation: 18948
I ran into this same error with a custom user
app.
I deleted:
migrations
folders*.pyc
files__pycach__
directoriesthen I ran
python manage.py syncdb
And that did the trick
Upvotes: 1
Reputation: 20339
Did you trying to use custom User
model since AUTH_USER_MODEL = 'backend.User'
?
So You have to try like this.
./manage.py makemigrations backend
From https://docs.djangoproject.com/en/1.7/topics/migrations/#s-custom-fields
Upvotes: 3