ernestophone.ens.fr/Ernestophone/settings/common.py

107 lines
2.6 KiB
Python
Raw Normal View History

2015-03-17 19:03:51 +01:00
import os
try:
from . import secret
except ImportError:
raise ImportError(
"The secret.py file is missing.\n"
"For a development environment, simply copy secret_example.py"
)
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))
SECRET_KEY = import_secret("SECRET_KEY")
ADMINS = import_secret("ADMINS")
SERVER_EMAIL = import_secret("SERVER_EMAIL")
2015-03-17 19:03:51 +01:00
DBNAME = import_secret("DBNAME")
DBUSER = import_secret("DBUSER")
DBPASSWD = import_secret("DBPASSWD")
2015-03-17 19:03:51 +01:00
BASE_DIR = os.path.join(
os.path.dirname(__file__), "..", ".."
)
2015-03-17 19:03:51 +01: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',
'pads',
]
2015-03-17 19:03:51 +01: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',
]
2015-03-17 19:03:51 +01:00
ROOT_URLCONF = "Ernestophone.urls"
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates/'),
],
'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',
],
}
}]
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": DBNAME,
"USER": DBUSER,
"PASSWORD": DBPASSWD,
"HOST": "localhost",
}
}
2015-03-17 19:03:51 +01: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 = (
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"