moviewyrm/rebuilddb.sh

31 lines
848 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
rm fedireads.db
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
echo "from fedireads.models import User
User.objects.create_user('mouse', 'mouse.reeve@gmail.com', 'password123')" | python manage.py shell
echo "from fedireads.models import User
2020-01-27 01:55:02 +00:00
User.objects.create_user('rat', 'rat@rat.com', 'ratword')
User.objects.get(id=1).followers.add(User.objects.get(id=2))" | python manage.py shell
echo "from fedireads.openlibrary import get_or_create_book
2020-02-11 05:09:04 +00:00
get_or_create_book('OL1715344W')
get_or_create_book('OL102749W')" | python manage.py shell
2020-01-27 01:55:02 +00:00
python manage.py runserver