Django manage.py Unknown command: 'syncdb'

84,483

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.

Share:
84,483
jeff
Author by

jeff

Updated on August 19, 2021

Comments

  • jeff
    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 contain syncdb 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
    jeff over 9 years
    Thanks! I'm surprised that Google didn't bring that to my attention :D
  • catavaran
    catavaran over 9 years
    Try to remove your app from the INSTALLED_APPS and run migrate again. The error still occurs?
  • jeff
    jeff over 9 years
    I pasted the result in the question
  • catavaran
    catavaran over 9 years
    Hm. Return the blog back to the INSTALLED_APPS and then run python manage.py migrate contenttypes?
  • alexef
    alexef over 8 years
    You can run manage.py migrate --run-syncdb if you have old applications that don't have migrations.