This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
65 lines (60 loc) · 1.47 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
PYTHON=${1:-python3}
echo "Checking requirements..."
# Requiring Python>=3.8 w/ venv support
if ! command -v $PYTHON > /dev/null 2>&1
then
report_requires "Python 3"
else
if ! $PYTHON -c "import sys; assert sys.version_info >= (3, 9)" > /dev/null 2>&1
then
err "Python executed was outdated!"
report_requires "Python 3.9 or greater"
else
if ! $PYTHON -c "import ensurepip" > /dev/null 2>&1
then
err "Python's ensurepip not found!"
report_requires "Python virtual environment support"
fi
fi
fi
echo "requirements met!"
# create virtual environment
OS="`uname`"
# will change to vitualenv later
echo "creating virtual environment..."
case $OS in
'Darwin')
python3 -m venv env
;;
'WindowsNT')
python -m venv env
;;
*)
python -m venv env
esac
echo "created"
echo "activating the environment..."
case $OS in
'Darwin')
source env/bin/activate
;;
'WindowsNT')
env\Scripts\activate
;;
*)
source env/bin/activate
esac
echo "activated"
echo installing requirements...
pip install -r requirements.txt > /dev/null 2>&1;
echo "install complete"
echo "migration..."
python manage.py migrate > /dev/null 2>&1;
echo "finished"
echo "loading data..."
python manage.py loaddata data.json > /dev/null 2>&1;
echo "finished"
echo "setup finished"
echo "To run application, run 'python manage.py runserver' and goto '127.0.0.1:8000' in your browser"
echo
echo "Have a nice day!"