J
J
Jekson2021-08-30 11:20:32
Django
Jekson, 2021-08-30 11:20:32

Creating migrations for a single module in an application?

There is an application

PROJECT_APPS = (
    ....
    myapp
    ....
)

The application has several separate files with models
myapp
    - models
        -- model1.py
        -- model2.py

It is necessary to create a migration for only one file, let it be model1
I try
python manage.py makemigrations myapp/models/model1.py

But I get
No installed app with label myapp/models/model1.py

How to correctly execute such a command?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mkone112, 2021-08-30
@Lepilov

Just myapp and you need to use the app label you specified in the app config. Migrations will only be generated for models that have changed. Well, or as an option, generate all migrations, and delete what is not needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question