Kimmo Hintikka
Kimmo Hintikka

Reputation: 15490

Difference between migrate and syncdb commands in django?

I was not able to find this is django.org, so is Django 1.7 supposed to create superuser in the first run automatically?

Last time I used Django it was 1.6.x and command to run was syncdb. Now command is migrate and it does not seem prompt you to create superuser.

I can easily fix this by running python manage.py createsuperuser, but is this a bug or working as intended as all the tutorial refer you to create user in the first run?

This is what migrate does when I run it.

Operations to perform:
  Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying sessions.0001_initial... OK

This is new virtualenv with just, Python 2.7, pip and Django 1.7

Upvotes: 4

Views: 583

Answers (2)

Miskov
Miskov

Reputation: 178

From docs - Migrate:

Unlike syncdb, this command does not prompt you to create a superuser if one doesn’t exist (assuming you are using django.contrib.auth). Use createsuperuser to do that if you wish.

https://docs.djangoproject.com/en/1.8/ref/django-admin/#migrate-app-label-migrationname

Upvotes: 3

Muhammad Taqi
Muhammad Taqi

Reputation: 5424

basically follows the same process as South (at least for the standard migration process) – it just simplifies things a bit.

enter image description here

After migration command run python manage.py createsuperuser command to create super user.

Read this also https://realpython.com/blog/python/django-migrations-a-primer/

Upvotes: 1

Related Questions