Reset SQLite database in Django

后端 未结 5 590
孤街浪徒
孤街浪徒 2021-02-01 22:34

I am trying to refactor a Django project. I renamed a couple apps and added a new one, as well as shuffled some models around. I want to clear my database and migrations and sta

5条回答
  •  佛祖请我去吃肉
    2021-02-01 23:05

    This may help you if you want to clear sqlite3 DB follow these steps.

    1. Delete migrations files except init.py
    2. Delete dbsqlit3 file
    3. Then type python/python3 manage.py migrate
    4. Then make changes in your models
    5. Type python/python3 manage.py makemigrations
    6. Type python/python3 manage.py migrate
    7. Then you have to create new superuser by just typing python/python3 manage.py createsuperuser . you should use new name not old user name

提交回复
热议问题