0

I use django-admin startproject to create a new project, then use python manage.py migrate.

I find there are some tables will create by default. enter image description here

I want migrate my tables only when I run python manage.py migrate. Is it possible to skip the default?

Hou ZeYu
  • 341
  • 1
  • 3
  • 11
  • You can apply migrations manually. See `manage.py migrate --help`. But don't expect your application to work properly until all migrations are applied. – Klaus D. Jul 18 '20 at 06:32
  • Not sure if you can, but you can directly apply the migration to your app. `manage.py migrate {app_name}` – Joe Akanesuvan Jul 18 '20 at 06:36

1 Answers1

0

By default, INSTALLED_APPS contains django.contrib.admin and django.contrib.auth apps (along with few other apps). These apps are part of Django. These apps are optional, and can be removed if you do not need functionality they provide (See: Run django application without django.contrib.admin).

python manage.py makemigrations will create the migrations files for all the changes to models in all the apps.
And python manage.py migrate will apply previously computed migrations to the database.

When you have multiple apps, use python manage.py makemigrations [app_name], and python manage.py migrate [app_name] to limit these operations to specific app.

narendra-choudhary
  • 4,582
  • 4
  • 38
  • 58