Adapt to new settings organization (#5593)

This commit is contained in:
Thomas NOËL 2014-10-02 13:49:38 +02:00
parent dea4e97759
commit 85c73a3509
11 changed files with 57 additions and 100 deletions

View File

@ -1,8 +0,0 @@
passerelle for Debian
---------------------
To install the database please use the following command::
# su passerelle -p -c 'passerelle_manage.py syncdb'
-- Jérôme Schneider <jschneider@entrouvert.com> Fri, 10 May 2013 10:08:45 +0200

7
config.py Normal file
View File

@ -0,0 +1,7 @@
# Configuration for passerelle.
# This file is sourced by "execfile" from /usr/lib/passerelle/debian_config.py
#TIME_ZONE = 'Europe/Paris'
#LANGUAGE_CODE = 'fr-fr'

12
control
View File

@ -3,7 +3,7 @@ Section: python
Priority: optional
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
Build-Depends: debhelper (>= 8.0.0),
python-django (>= 1.5.0),
python-django,
python-setuptools
Standards-Version: 3.9.4
Homepage: https://dev.entrouvert.org/projects/passerelle
@ -12,15 +12,15 @@ Package: passerelle
Architecture: all
Depends: ${python:Depends},
${misc:Depends},
gunicorn (>= 0.14),
python-django (>= 1.5.0),
gunicorn,
python-django,
python-django-jsonresponse,
python-django-model-utils,
python-mako,
python-django-south (>= 0.8), python-django-south (<< 0.9),
python-django-south,
python-setuptools,
python-gadjo,
sudo
Recommends: python-soappy, python-sqlalchemy, python-phpserialize
Recommends: python-soappy, python-phpserialize
Suggests: python-sqlalchemy, python-mako
Description: Passerelle provides an uniform access to multiple data sources and services.
Passerelle provides an uniform access to multiple data sources and services.

13
debian_config.py Normal file
View File

@ -0,0 +1,13 @@
from django.conf.settings import *
import os
ETC_DIR = '/etc/passerelle'
VAR_DIR = '/var/lib/passerelle'
RUN_DIR = '/var/run/passerelle'
STATIC_ROOT = os.path.join(VAR_DIR, 'collected-static')
STATICFILES_DIRS = (os.path.join(VAR_DIR, 'static'),) + STATICFILES_DIRS
TEMPLATE_DIRS = (os.path.join(VAR_DIR, 'templates'),) + TEMPLATE_DIRS
LOCALE_PATHS = (os.path.join(VAR_DIR, 'locale'),) + LOCALE_PATHS
TENANT_BASE = os.path.join(VAR_DIR, 'tenants')
execfile(os.path.join(ETC_DIR, 'config.py'))

View File

@ -1 +1,7 @@
# export TENANT_BASE=/var/lib/passerelle/tenants/
# Default settings for passerelle. This file is sourced by /bin/sh from
# /etc/init.d/passerelle.
# Settings flavor
DJANGO_SETTINGS_MODULE=passerelle.settings
# for multitenant mode, use :
# DJANGO_SETTINGS_MODULE=passerelle.tenant_settings

21
init.d
View File

@ -19,8 +19,13 @@ RUN_DIR=/var/run/$NAME
PIDFILE=$RUN_DIR/$NAME.pid
LOG_DIR=/var/log/$NAME
SCRIPTNAME=/etc/init.d/$NAME
MANAGE_SCRIPT=/usr/lib/$NAME/manage.py
BIND=unix:$RUN_DIR/$NAME.sock
WORKERS=5
TIMEOUT=10
MANAGE_SCRIPT=/usr/lib/$NAME/manage.py
DJANGO_SETTINGS_MODULE=passerelle.settings
DJANGO_CONFIG_FILE=/usr/lib/$NAME/debian_config.py
USER=$NAME
GROUP=$NAME
@ -37,9 +42,9 @@ DAEMON_ARGS=${DAEMON_ARGS:-"--pid $PIDFILE \
--access-logfile $LOG_DIR/gunicorn-access.log \
--log-file $LOG_DIR/gunicorn-error.log \
--bind=$BIND \
--workers=10 \
--workers=$WORKERS \
--worker-class=sync \
--timeout=60 \
--timeout=$TIMEOUT \
--name $NAME \
passerelle.wsgi:application"}
@ -55,6 +60,14 @@ if [ ! -d $RUN_DIR ]; then
install -d -m 755 -o $USER -g $GROUP $RUN_DIR
fi
# environment for wsgi & settings
export DJANGO_SETTINGS_MODULE
export DJANGO_CONFIG_FILE
# multitenant mode
if [ "x$DJANGO_SETTINGS_MODULE" != "xpasserelle.tenant_settings" ]; then
TENANT_BASE=/var/lib/$NAME/tenants
fi
#
# Function that starts the daemon/service
#
@ -198,7 +211,7 @@ case "$1" in
TENANT=`su $USER -p -c "python $MANAGE_SCRIPT get_tenant_by_domain \"$1\""`
log_daemon_msg "Creating tenant" "$TENANT"
if [ "x$TENANT_BASE" == "x" ]; then
log_failure_msg "TENANT_BASE is not set in /etc/default/$NAME"
log_failure_msg "multitenant mode not set in /etc/default/$NAME"
log_end_msg 1
else
TENANT_DIR="$TENANT_BASE/$TENANT/"

View File

@ -1 +1,3 @@
debian/local_settings.py /etc/passerelle/
debian/passerelle-manage /usr/bin
debian/debian_config.py /usr/lib/passerelle
debian/config.py /etc/passerelle

View File

@ -1,62 +0,0 @@
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# traceback recipients if DEBUG=False
ADMINS = (
# ('root', 'root@localhost'),
# ('admin passerelle', 'admin-passerelle@domaine.com'),
)
MANAGERS = ADMINS
# we're behind a pile of reverse-proxies...
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/Paris'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'fr-fr'
#
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/var/lib/passerelle/passerelle.db',
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'south',
'passerelle.base',
'passerelle.datasources',
'passerelle.repost',
'passerelle.messages',
'passerelle.register',
# 'clicrdv',
# 'gdc',
# 'solis',
# 'makorepost',
# 'choosit',
)
MEDIA_ROOT = '/var/lib/passerelle/media'
MEDIA_URL = '/passerelle/media/'
STATIC_ROOT = '/var/lib/passerelle/static'
STATIC_URL = '/passerelle/static/'

3
passerelle-manage Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
/etc/init.d/passerelle manage "$@"

14
postrm
View File

@ -1,14 +0,0 @@
#!/bin/sh
# postrm script for passerelle
#
# see: dh_installdeb(1)
set -e
case "$1" in purge)
deluser --quiet --system passerelle > /dev/null || true
;;
esac
exit 0

5
rules
View File

@ -16,8 +16,5 @@ BUILD_DIR := 'debian/passerelle'
override_dh_install:
dh_install
for ver in $(shell pyversions -vr); do \
ln -s /etc/passerelle/local_settings.py $(BUILD_DIR)/usr/lib/python$$ver/dist-packages/passerelle/; \
done
mv $(BUILD_DIR)/usr/bin/passerelle_manage.py $(BUILD_DIR)/usr/lib/passerelle/manage.py
mv $(BUILD_DIR)/usr/bin/manage.py $(BUILD_DIR)/usr/lib/passerelle/manage.py