Django - Utility bash script to reset the db
The following bash script is used when I want to reset my Django app's db to a fresh state (with some initial data, fixtures) in some test cases: #!/usr/bin/env bash mysqladmin -u myuser -p'myuser_pwd' -f drop dj_ecap mysqladmin -u myuser -p'myuser_pwd' create dj_ecap /home/.venv/myenv/bin/python manage.py syncdb /home/.venv/myenv/bin/python manage.py loaddata path/to/my/fixtures/*.json mysql -u myuser -p'myuser_pwd' -h localhost mydb < path/to/my/fixtures/group.sql The last line is to import some intial groups into django.contrib.auth.models.Group table.