-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.sh
executable file
·48 lines (37 loc) · 895 Bytes
/
setup.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
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
set -o pipefail # if any code doesn't return 0, exit the script
set -x # print each step of your code to the terminal
function venv() {
echo 'Do you want me to install and activate a virtualenvironment?'
echo 'Enter y or n'
read response
if [ $response == "y" ]; then
pip install virtualenv
virtualenv --python=python3 venv
source venv/bin/activate
else
echo 'I take it you have a virtual environment activated'
fi
}
function setup_server() {
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
}
function setup_client() {
yarn -v
export status=$?
echo $status
if (($status!=0)); then
echo 'I will be installing yarn for you now'
npm install -g yarn
fi
yarn install
webpack --config=webpack.config.dev
}
venv
setup_server
setup_client
yarn start:dev & python manage.py runserver 0.0.0.0:8000
exit 0