Django manage.py Unknown command: 'syncdb'
Solution 1
syncdb
command is deprecated in django 1.7. Use the python manage.py migrate
instead.
Solution 2
You have to use python manage.py migrate
instead rather than python manage.py syncdb
Solution 3
Run python manage.py makemigrations
result below
Migrations for 'blog':
blog/migrations/0001_initial.py:
- Create model Blog
and after that run python manage.py migrate
result below
Operations to perform:
Apply all migrations: admin, blog, auth, contenttypes, sessions
Running migrations:
Applying article.0001_initial... OK
Solution 4
the actual command is :
python manage.py migrate --run-syncdb
It will solve many errors in django like , Operational error ,No Table found in databse etc.
jeff
Updated on August 19, 2021Comments
-
jeff almost 3 years
I'm trying to follow this tutorial but I'm stuck on the 5th step.
When I execute
[~/Django Projects/netmag$]
python manage.py syncdb
I get the following error message :
Unknown command: 'syncdb' Type 'manage.py help' for usage.
and here is the output of
./manage.py help
does not containsyncdb
command. How do I add it?Thanks for any help!
Edit :
When I run migrate, I get this error :
"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.
in settings.py :
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admindocs', 'blog', ]
Edit 2:
If I remove
'blog',
from settings.py ::~/Django Projects/netmag$ python manage.py migrate blog CommandError: App 'blog' does not have migrations. :~/Django Projects/netmag$ python manage.py makemigrations blog App 'blog' could not be found. Is it in INSTALLED_APPS?
-
jeff over 9 yearsThanks! I'm surprised that Google didn't bring that to my attention :D
-
catavaran over 9 yearsTry to remove your app from the
INSTALLED_APPS
and runmigrate
again. The error still occurs? -
jeff over 9 yearsI pasted the result in the question
-
catavaran over 9 yearsHm. Return the
blog
back to theINSTALLED_APPS
and then runpython manage.py migrate contenttypes
? -
alexef over 8 yearsYou can run
manage.py migrate --run-syncdb
if you have old applications that don't have migrations.