forked from openplans/shareabouts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinstall
executable file
·57 lines (43 loc) · 1.98 KB
/
postinstall
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
#!/bin/sh
# =============================================================================
# Post-install hook file for configuring dotcloud server
echo "Writing the local settings file..."
echo " - Setting the path to the Shareabouts config"
echo " - Adding the flavor to the installed applications"
echo " - Setting the dataset access location and key"
cat >> src/project/local_settings.py <<EOF
import json
import os.path
with open('/home/dotcloud/environment.json') as f:
env = json.load(f)
# The SHAREABOUTS_FLAVOR environment variable is used as a prefix for the
# Shareabouts configuration. configuration is expected to live in a package
# named 'flavors.<SHAREABOUTS_FLAVOR>'. This package will correspond to a
# folder in the root of the src tree that contains all the configuration
# information for the flavor.
SHAREABOUTS = {
'FLAVOR': env.get('SHAREABOUTS_FLAVOR', 'SHAREABOUTS_FLAVOR-not-set-in-dotcloud-environment!!!'),
'DATASET_KEY': env.get('SHAREABOUTS_DATASET_KEY', 'SHAREABOUTS_DATASET_KEY-not-set-in-dotcloud-environment!!!'),
'DATASET_ROOT': env.get('SHAREABOUTS_DATASET_ROOT', 'SHAREABOUTS_DATASET_ROOT-not-set-in-dotcloud-environment!!!'),
'CONTEXT': {
'analytics_key': env.get('SHAREABOUTS_ANALYTICS_KEY', 'SHAREABOUTS_ANALYTICS_KEY-not-set-in-dotcloud-environment!!!'),
'feedback_key': env.get('SHAREABOUTS_FEEDBACK_KEY', 'SHAREABOUTS_FEEDBACK_KEY-not-set-in-dotcloud-environment!!!'),
}
}
STATIC_ROOT = '/home/dotcloud/current/static/'
# Debug is False by default, true if set in the environment.
DEBUG = (env.get('DEBUG', 'False') in ['true', 'True'])
TEMPLATE_DEBUG = DEBUG
EOF
echo "Setting up static file service..."
src/manage.py collectstatic --noinput
echo "Configuring nginx to serve static files..."
cat >> nginx.conf <<EOF
location /static/ { root /home/dotcloud/current ; }
EOF
echo "Compiling translations..."
cd src/sa_web
../manage.py compilemessages
cd ../flavors/$SHAREABOUTS_FLAVOR
../../manage.py compilemessages
cd ../../..