forked from adrrf/decide-part-camaron
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.bash
executable file
·30 lines (30 loc) · 1.06 KB
/
setup.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cd "${0%/*}"
cd decide
cp local_settings.example.py local_settings.py
sed -i "s/10.*:/localhost:/" local_settings.py
sed -i "s/\"NAME\": \"postgres\"/\"NAME\": \"decidedb\"/" local_settings.py
sed -i "s/\"USER\": \"postgres\"/\"USER\": \"decideuser\"/" local_settings.py
sed -i "s/\"HOST\": \"db\"/\"HOST\": \"localhost\",\n \"PASSWORD\": \"decidepass123\"/g" local_settings.py
echo "Created local_settings.py"
cd ..
python -m venv venv
source venv/bin/activate
echo "Created Python virtual environment"
pip install -r requirements.txt
sudo su - postgres <<EOF
psql -c "drop database if exists decidedb"
psql -c "drop user if exists decideuser"
psql -c "create user decideuser with password 'decidepass123'"
psql -c "create database decidedb owner decideuser"
psql -c "ALTER USER decideuser CREATEDB"
EOF
echo "Created database"
cd decide
python manage.py migrate
python manage.py createsuperuser --noinput --username admin --email [email protected]
python manage.py shell <<EOF
from django.contrib.auth.models import User
u = User.objects.all()[0]
u.set_password('admin')
u.save()
EOF