forked from bitsoffreedom/pim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.sh
executable file
·60 lines (49 loc) · 1.48 KB
/
prepare.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
#!/bin/sh
PWD=`dirname $0`
BASEPATH=`basename $PWD`
GIT=git
VIRTUALENV="virtualenv --distribute"
PIP="pip --timeout 30 -q"
ENVDIR=env
if [ ! -d $ENVDIR ]; then
echo "Preparing virtualenv environment in $ENVDIR directory"
if pip install virtualenv; then
echo 'VirtualEnv installed allright'
else
echo 'Error installing VirtualEnv, breaking off'
exit 1
fi
$VIRTUALENV $ENVDIR
fi
echo 'Installing required packages'
if pip install -E $ENVDIR -r requirements.txt; then
echo 'That went allright, continue'
else
echo 'Error installing dependencies, breaking off'
exit 1
fi
if [ ! -f portnumber ]; then
echo 'Port number not set.'
while [ -z "$PORTNUMBER" ]; do
echo 'Which port number should the builtin server listen to? '
read PORTNUMBER
echo
echo "Setting default port number to: $PORTNUMBER"
echo
done
echo $PORTNUMBER > portnumber
fi
if [ ! -f settings_local.py ]; then
echo 'No local settings file found.'
cp -v settings_local.py.example settings_local.py
echo
echo 'Generating secret key in settings_local.py.'
SECRET_KEY=`./runserver.sh generate_secret_key`
echo >> settings_local.py
echo "# Make this unique, and don't share it with anybody." >> settings_local.py
echo "SECRET_KEY = '$SECRET_KEY'" >> settings_local.py
fi
if [ ! -f database.sqlite ]; then
echo 'No database found, running syncdb.'
./runserver.sh syncdb
fi