Skip to content

Instantly share code, notes, and snippets.

@vubon
Created May 23, 2018 03:17
Show Gist options
  • Save vubon/51fbe7d6e65366d1f439b4803e897555 to your computer and use it in GitHub Desktop.
Save vubon/51fbe7d6e65366d1f439b4803e897555 to your computer and use it in GitHub Desktop.
Reset Database by bash script
#!/usr/bin/env bash
DEFAULT_USER="admin"
DEFAULT_EMAIL="[email protected]"
DEFAULT_PASS="nothing1234"
######### MAIN CLEAN #########
rm 'db.sqlite3'
readonly virtual='/home/vubon/personal/upwork_env/bin/activate'
source ${virtual}
python manage.py makemigrations
python manage.py migrate
echo "from django.contrib.auth.models import User; User.objects.create_superuser('$DEFAULT_USER', '$DEFAULT_EMAIL', '$DEFAULT_PASS')" | python manage.py shell --plain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment