-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathscripts.sh
executable file
·37 lines (31 loc) · 935 Bytes
/
scripts.sh
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
31
32
33
34
35
36
37
#!/usr/bin/env bash
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASE_DIR="${PWD##*/}"
init() {
deactivate || true
rm -r $ROOT/venv || true
mkdir -p $ROOT/venv
python3 -m venv $ROOT/venv/$BASE_DIR &&
source $ROOT/venv/$BASE_DIR/bin/activate &&
pip install -r requirements.txt &&
pip install -r requirements-dev.txt
}
run_server() {
(echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '[email protected]', 'password')" | python manage.py shell) > /dev/null 2>&1;
python manage.py makemigrations && python manage.py migrate && python manage.py runserver
}
run_prod() {
APP_STAGE="production"
run_server
}
alias run:prod=run_prod
run_dev() {
APP_STAGE="developement"
run_server
}
alias run:dev=run_dev
run_container() {
APP_STAGE="containerized"
docker-compose up "$@"
}
alias run:container=run_container