django use makemigrations and migrate database migration and the problems encountered

surroundings

windows10
pycharm2017.3.3 professional edition
python3.6.4
django2.0.2

method

makemigrations migrations will generate a folder in the current directory, the contents of the folder is the database contents to be executed

manage.py makemigrations Python
the migrate is generated before executing migrations file, this step is a step operation of the database

python manage.py migrate

Remark

Django each update models need to perform more than two steps, to note that the increase Django model content needs to set the initial value of the variable, otherwise the problem will appear in the first step

Problems encountered

After you import a project, create the appropriate database, project execution order, found that the data can not be migrated
Here Insert Picture Description
at this time need to specify the directory
Here Insert Picture Description
base directories for the two projects, with the same directory as manage.py.

Published 82 original articles · won praise 43 · views 180 000 +

Guess you like

Origin blog.csdn.net/liudinglong1989/article/details/103064198