step1 # 修改app下的model
step2 # 将app添加的项目中 最后一行
Python
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"brands.apps.BrandsConfig",
"appName",
]
step3 # 创建migration
python manage.py makemigrations1
step4 # 将migration同步到数据库
python manage.py migrate
# 多数据库
python manage.py migrate --database=db1
#数据导出
python manage.py dumpdata app1 --database=db1 > app1_fixture.json
python manage.py dumpdata app2 --database=db2 > app2_fixture.json
python manage.py dumpdata auth > auth_fixture.json
#数据库导入
python manage.py loaddata app1_fixture.json --database=db1
python manage.py loaddata app2_fixture.json --database=db2