Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

reset django database

WARNING! You will loose everything that was in the database!
1/ Delete everything in:
	- migrations
    - __pycache__
2/ Delete the database
	- db.sqlite3
3/ Run, in this order:
	- python3 manage.py makemigrations
    - python3 manage.py migrate --run-syncdb

(OPTIONAL)
Run "python3 manage.py makesuperuser", you deleted the previous one!

Tested only with sqlite, not the best choice if you are in production.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reset #django #database
ADD COMMENT
Topic
Name
9+4 =