moviewyrm/rebuilddb.sh

26 lines
447 B
Bash
Raw Normal View History

2020-01-26 20:14:27 +00:00
#!/bin/bash
set -e
if [ ! -f .env ]; then
echo "No .env found -- copying .example.env to .env!"
cp .env.example .env
fi
2020-02-15 22:19:36 +00:00
source .env
if [ $FEDIREADS_DATABASE_BACKEND = 'sqlite' ]; then
if [ -f fedireads.db ]; then
rm fedireads.db
fi
2020-02-15 22:19:36 +00:00
else
# assume postgres
dropdb fedireads
createdb fedireads
fi
2020-01-26 20:14:27 +00:00
python manage.py makemigrations fedireads
python manage.py migrate
python manage.py shell < init_db.py
2020-01-27 01:55:02 +00:00
python manage.py runserver