0

As the title says running python manage.py migrate runs the migrations but no migrations directory is produced in the app directory hence no tables from models.py exist.

  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK

This is quite new error to me. What should I do ?

Mark
  • 1,385
  • 3
  • 16
  • 29
  • This is not an error. It just says what migrations it has applied. You first need to `makemigration` to generate the migration files. – Willem Van Onsem Sep 04 '19 at 11:52

3 Answers3

3

python manage.py migrate only runs the existing migrations, it does not make new ones. What you're looking for is probably python manage.py makemigrations.

Clarity
  • 10,730
  • 2
  • 25
  • 35
  • `python manage.py makemigrations` gives me nothing: `No changes detected`. – Mark Sep 04 '19 at 11:59
  • If you get `No changes detected`, then use `python manage.py makemigrations yourapp` to create initial migrations for your app. See https://stackoverflow.com/questions/36153748/django-makemigrations-no-changes-detected/36154224#36154224 – Alasdair Sep 04 '19 at 12:22
0

You should check that you have migrations directory with an empty __init__.py file in it. then add your app name (or app address) in INSTALLED_APP (in settings.py) then use python manage.py makemigrations to make migration files.

Now you can use migration command!

mrash
  • 883
  • 7
  • 18
  • As advised, I created `migrations` directory with init file in it and it works now. Bless you buddy ! – Mark Sep 04 '19 at 12:28
0

You can try:

python manage.py migrate 'yourappname'

Or:

python manage.py makemigrations 'yourappname'