forked from briot/geneapro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·78 lines (60 loc) · 1.81 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Setup geneaprove for end-users and developers
# Which python interpreter to use (need python 3)
# Only needed when no virtualenv has been setup yet
PYTHON=${PYTHON:-python3.6}
VIRTUALENV=${VIRTUALENV:-virtualenv}
NODE=${NODE:-node}
DEVELOPER=${DEVELOPER:-no}
#########################
# Front-end development #
#########################
npm install
########################
# Back-end development #
########################
if [ ! -d python_env ]; then
$PYTHON --version 2>&1 | grep " 3.6" >/dev/null
if [ $? != 0 ]; then
echo "Python not found (needs 3.6)"
exit 1
fi
${VIRTUALENV} --python="$PYTHON" --quiet --version >/dev/null
if [ $? != 0 ]; then
echo "Virtualenv not found"
exit 1
fi
${VIRTUALENV} --python="$PYTHON" python_env
source python_env/bin/activate
else
# Check installed python version
source python_env/bin/activate
python --version 2>&1 | grep " 3.6" >/dev/null
if [ $? != 0 ]; then
echo "Incorrect python version in python_env/: needs 3.6"
echo "Remove python_env/ and rerun $0"
exit 1
fi
fi
pip install "django>=2.1" pillow grandalf "django-prepared-query" appdirs "psycopg2-binary"
if [ "$DEVELOPER" != "no" ]; then
# Some useful tools for developers.
pip install pylint pylint-django pep8 autopep8 cprofilev pyinstaller
fi
# The actual layout of the sources was created with:
# django-admin startproject backend
# cd backend
# ./manage.py startapp geneaprove
###################
# Create database #
###################
(
cd backend
dir=`./manage.py showconf | grep dir= | cut -d= -f2`
mkdir -p "$dir"
./manage.py makemigrations
./manage.py migrate
)
#########################################
# Generate the sources and start server #
#########################################
sh ./tmux.sh