irongit
rango/dev
46 lines1016 B
1#!/bin/bash
2# For development only
3
4# if venv doesn't exist, create it
5if [ ! -d "venv" ]; then
6 python -m venv venv
7fi
8
9# if venv is not activated, activate it
10if [ -z "$VIRTUAL_ENV" ]; then
11 source venv/Scripts/activate
12fi
13
14# if first arg is var, add a variable to venv/Scripts/activate
15if [ "$1" = "var" ]; then
16 echo "export $2=$3" >> venv/Scripts/activate
17 # if venv is activated, deactivate it
18 if [ ! -z "$VIRTUAL_ENV" ]; then
19 deactivate
20 fi
21 source venv/Scripts/activate
22fi
23
24# if first arg is back, build frontend and run backend
25if [ "$1" = "back" ]; then
26 # build the frontend
27 cd rango/frontend
28 npm run build
29 cd ..
30
31 # create secret key
32 cd backend
33 python manage.py createsecret
34
35 # migrate database
36 python manage.py migrate
37
38 # run backend development server
39 python manage.py runserver & cd ../..
40fi
41
42# if first arg is front, run frontend development server
43if [ "$1" = "front" ]; then
44 cd rango/frontend
45 npm run dev & cd ../..
46fi