Unknown command: 'syncdb' when running server in Django 1.9.1

django

#1

Hi, with the latest django version (1.9.1) I get an error message: Unknown command: ‘syncdb’ when I want to run the project (i.e. the manage.py runserver command). I believe ‘syncdb’ is deprecated in Django 1.9 in favour of ‘makemigrations’ and then ‘migrate’.


#2

You’re correct @gbellak, syncdb has actually been completely removed in Django 1.9, I noticed this when upgrading recently as well.

See the official Django deprecation timeline here:

But you’re getting an error when running python ./manage.py runserver $IP:$PORT :question:
If so, my guess is it could be something sticking on the migrations.

See this SO on the topic here:

Best,
Mike
:alien:


#3

Yes, on django 1.9 syncdb is removed.

They are 2 works around, get the most easy for you:

  1. Run your project from terminal instead run project button:

    python manage.py migrate
    python manage.py runserver $IP:$PORT

  2. Create a fake syncdb with a custom django-admin command, create this structure in one of your apps:

    someApp/
    management/
    init.py
    commands/
    init.py
    _private.py
    syncdb.py <----

Then fill syncdb.py file with this code:

from django.core.management.base import BaseCommand

class Command(BaseCommand):
    help = ''

    def handle(self, *args, **options):
        self.stdout.write('fake syncdb')

#4

Thanks for reporting! We’ll update the README in our default Django project to reflect this.


#5

We’ve since updated the README and the runner for Django projects so please add a note here if we need to take more action.