debian package enable multitenant by default (#5634)
This commit is contained in:
parent
65b44ddfd9
commit
a9442b9990
40
config.py
40
config.py
|
@ -16,40 +16,30 @@
|
|||
SECRET_KEY = '!!-Change-Me-Now-!!'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = True
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = False
|
||||
|
||||
ADMINS = (
|
||||
# ('User 1', 'watchdog@domain.com'),
|
||||
# ('User 2', 'janitor@domain.com'),
|
||||
# ('User 1', 'watchdog@example.net'),
|
||||
# ('User 2', 'janitor@example.net'),
|
||||
)
|
||||
|
||||
# ALLOWED_HOSTS must be correct in production!
|
||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = [
|
||||
'passerelle.domain.com',
|
||||
'passerelle.domain.com.',
|
||||
'passerelle.example.net',
|
||||
'passerelle.example.net.',
|
||||
'.passerelle.example.net',
|
||||
'.passerelle.example.net.',
|
||||
]
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': '/var/lib/passerelle/passerelle.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
# for a postgresql database:
|
||||
#DATABASES = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'django.db.backends.postgresql_psycopg2'
|
||||
# 'NAME': 'passerelle',
|
||||
# # if needed :
|
||||
# 'USER': 'user',
|
||||
# 'PASSWORD': 'password',
|
||||
# 'HOST': 'localhost',
|
||||
# 'PORT': '5432',
|
||||
# }
|
||||
#}
|
||||
# Passerelle use a postgresql database
|
||||
# Default: a local database named "passerelle"
|
||||
# DATABASES['default']['name'] = 'passerelle'
|
||||
# DATABASES['default']['user'] = 'passerelle'
|
||||
# DATABASES['default']['password'] = '******'
|
||||
# DATABASES['default']['host'] = 'localhost'
|
||||
# DATABASES['default']['port'] = '5432'
|
||||
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
|
5
control
5
control
|
@ -12,11 +12,12 @@ Package: passerelle
|
|||
Architecture: all
|
||||
Depends: ${python:Depends},
|
||||
${misc:Depends},
|
||||
python-entrouvert;
|
||||
gunicorn,
|
||||
python-django,
|
||||
python-django (< 1.7),
|
||||
python-django-south,
|
||||
python-django-jsonresponse,
|
||||
python-django-model-utils,
|
||||
python-django-south,
|
||||
python-requests,
|
||||
python-setuptools,
|
||||
python-gadjo,
|
||||
|
|
|
@ -5,10 +5,18 @@ import os
|
|||
ETC_DIR = '/etc/passerelle'
|
||||
VAR_DIR = '/var/lib/passerelle'
|
||||
RUN_DIR = '/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')
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2'
|
||||
'NAME': 'passerelle',
|
||||
}
|
||||
}
|
||||
|
||||
execfile(os.path.join(ETC_DIR, 'config.py'))
|
||||
|
|
7
default
7
default
|
@ -1,7 +0,0 @@
|
|||
# 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
|
2
init.d
2
init.d
|
@ -23,7 +23,7 @@ BIND=unix:$RUN_DIR/$NAME.sock
|
|||
WORKERS=5
|
||||
TIMEOUT=10
|
||||
|
||||
DJANGO_SETTINGS_MODULE=passerelle.settings
|
||||
DJANGO_SETTINGS_MODULE=passerelle.tenant_settings
|
||||
DJANGO_CONFIG_FILE=/usr/lib/$NAME/debian_config.py
|
||||
MANAGE_SCRIPT="python /usr/lib/$NAME/manage.py --config=$DJANGO_CONFIG_FILE"
|
||||
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
NAME=passerelle
|
||||
MANAGE="/usr/lib/$NAME/manage.py --multitenant --config=/usr/lib/${NAME}/debian_config.py"
|
||||
|
||||
if test $(id -un) != "$NAME"
|
||||
# check user
|
||||
if test x$1 = x"--forceuser"
|
||||
then
|
||||
echo "error: must use $0 with user ${NAME}"
|
||||
exit 1
|
||||
shift
|
||||
elif test $(id -un) != "$NAME"
|
||||
then
|
||||
echo "error: must use $0 with user ${NAME}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MANAGE_OPTIONS="--config=/usr/lib/${NAME}/debian_config.py"
|
||||
|
||||
. /etc/default/$NAME
|
||||
if test x"${DJANGO_SETTINGS_MODULE}" = "xpasserelle.tenant_settings"
|
||||
if test $# -eq 0
|
||||
then
|
||||
MANAGE_OPTIONS="${MANAGE_OPTIONS} --multitenant"
|
||||
python ${MANAGE} help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo python /usr/lib/$NAME/manage.py ${MANAGE_OPTIONS} "$@"
|
||||
python /usr/lib/$NAME/manage.py ${MANAGE_OPTIONS} "$@"
|
||||
python ${MANAGE} "$@"
|
||||
|
||||
|
|
Loading…
Reference in New Issue