Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 109 lines (92 sloc) 3.337 kB
#!/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
ALLOWED_HOSTS = ['*']
admin_email = env.get('SHAREABOUTS_ADMIN_EMAIL')
if admin_email:
projname = env.get('DOTCLOUD_PROJECT')
username = env.get('DOTCLOUD_USERNAME')
ADMINS = (
('Shareabouts - %s:%s' % (projname, username), admin_email),
)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(name)s: %(message)s %(process)d %(thread)d'
},
'moderate': {
'format': '%(levelname)s %(asctime)s %(name)s: %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
EOF
echo "Setting up static file service..."
python src/manage.py collectstatic --noinput
echo "Configuring nginx to serve static files..."
cat >> nginx.conf <<EOF
location /static/ {
root /home/dotcloud/current ;
expires max;
}
gzip on;
gzip_types
text/plain text/html text/css text/csv
application/json application/javascript;
EOF
echo "Compiling translations..."
cd src/sa_web
python ../manage.py compilemessages
cd ../flavors/$SHAREABOUTS_FLAVOR
python ../../manage.py compilemessages
cd ../../..
Jump to Line
Something went wrong with that request. Please try again.