2015-03-17 19:03:51 +01:00
|
|
|
import os
|
2016-06-21 00:45:21 +02:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
try:
|
|
|
|
from . import secret
|
|
|
|
except ImportError:
|
|
|
|
raise ImportError(
|
|
|
|
"The secret.py file is missing.\n"
|
|
|
|
"For a development environment, simply copy secret_example.py"
|
|
|
|
)
|
2016-06-25 01:09:09 +02:00
|
|
|
|
2016-06-21 00:45:21 +02:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
def import_secret(name):
|
|
|
|
"""
|
|
|
|
Shorthand for importing a value from the secret module and raising an
|
|
|
|
informative exception if a secret is missing.
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
return getattr(secret, name)
|
|
|
|
except AttributeError:
|
|
|
|
raise RuntimeError("Secret missing: {}".format(name))
|
2016-06-21 00:45:21 +02:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
SECRET_KEY = import_secret("SECRET_KEY")
|
|
|
|
ADMINS = import_secret("ADMINS")
|
|
|
|
SERVER_EMAIL = import_secret("SERVER_EMAIL")
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
DBNAME = import_secret("DBNAME")
|
|
|
|
DBUSER = import_secret("DBUSER")
|
|
|
|
DBPASSWD = import_secret("DBPASSWD")
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-15 16:34:39 +02:00
|
|
|
ACCOUNT_CREATION_PASS = import_secret("ACCOUNT_CREATION_PASS")
|
|
|
|
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
BASE_DIR = os.path.join(
|
|
|
|
os.path.dirname(__file__), "..", ".."
|
|
|
|
)
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
INSTALLED_APPS = [
|
2015-03-17 19:03:51 +01:00
|
|
|
'django.contrib.admin',
|
|
|
|
'django.contrib.auth',
|
|
|
|
'django.contrib.contenttypes',
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.messages',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'gestion',
|
|
|
|
'partitions',
|
2015-04-13 18:56:43 +02:00
|
|
|
'calendrier',
|
2015-07-22 22:08:59 +02:00
|
|
|
'propositions',
|
2016-06-21 00:45:21 +02:00
|
|
|
'pads',
|
2017-10-13 14:17:23 +02:00
|
|
|
]
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
MIDDLEWARE_CLASSES = [
|
2015-03-17 19:03:51 +01:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
'django.middleware.common.CommonMiddleware',
|
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
2017-10-13 14:17:23 +02:00
|
|
|
]
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
ROOT_URLCONF = "Ernestophone.urls"
|
2016-07-17 19:41:45 +02:00
|
|
|
|
|
|
|
TEMPLATES = [{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
os.path.join(BASE_DIR, 'templates/'),
|
|
|
|
],
|
2016-08-29 05:38:10 +02:00
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
|
'django.template.context_processors.i18n',
|
|
|
|
'django.template.context_processors.media',
|
|
|
|
'django.template.context_processors.static',
|
|
|
|
],
|
|
|
|
}
|
2016-07-17 19:41:45 +02:00
|
|
|
}]
|
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
DATABASES = {
|
|
|
|
"default": {
|
|
|
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
|
|
|
"NAME": DBNAME,
|
|
|
|
"USER": DBUSER,
|
|
|
|
"PASSWORD": DBPASSWD,
|
|
|
|
"HOST": "localhost",
|
|
|
|
}
|
|
|
|
}
|
2016-07-17 19:41:45 +02:00
|
|
|
|
2015-03-17 19:03:51 +01:00
|
|
|
|
2017-10-13 14:17:23 +02:00
|
|
|
# I18n
|
2015-03-17 19:03:51 +01:00
|
|
|
LANGUAGE_CODE = 'fr-fr'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
|
|
|
|
STATICFILES_DIRS = (
|
2016-06-21 00:45:21 +02:00
|
|
|
os.path.join(BASE_DIR, 'static'),
|
|
|
|
os.path.join(BASE_DIR, 'media/partitions'),
|
2015-03-17 19:03:51 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
AUTH_PROFILE_MODEL = 'gestion.ErnestoUser'
|
|
|
|
|
|
|
|
LOGIN_URL = "/login"
|