python manage.py sqlmigrate DouYin 0001
Funny Django, After deleting from the database , The database cannot be created again successfully . For a long time , Finally found a way . Delete the code you don't need and Server side database , Then, the local system still executes once
python manage.py makemigrations
python manage.py migrate
, Then use this command :
python manage.py sqlmigrate 【 Yours Modle name 】 0001
You can see one Sql sentence , Just execute this statement on the server , It is equivalent to creating a new data table on the server side , And then use Django The data in the table of is normal , You can normally delete and add operations .
If you encounter New fields always report errors , You can add... To the new field The default value is , And then the execution is Ok 了 .
The above method doesn't work !
The specific solution is :
python manage.py makemigrations app
app Means your Module