【Python】重置Django Migrate
阿新 • • 發佈:2019-02-15
wmi python nag pyc ini django ons com 插件
# 方式一
#
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
#
python manage.py makemigrations
python manage.py migrate
# 方式二
# 查看migrations
python manage.py showmigrations
# 刪除migrations文件,硬清理migration
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
# 軟清理Migration
python manage.py migrate --fake yourapp zero
# 查看migrations
python manage.py showmigrations
# 生成migrations
python manage.py makemigrations
# 虛擬重置Migrate
python manage.py migrate --fake-initial
# 方式三
# 新起一個Django Project
# 配置服務器連接
# 配置Model
# makemigrations
# migrate
# 註意:
django插件的重置,需要到site-packages目錄下刪除migrations文件
# 參考連接
export REFER_PAGE="https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html"
【Python】重置Django Migrate