forked from DGNum/gestiojeux
feat(FORK): Rework settings to be nicer for djangonix
This commit is contained in:
parent
3a730251d4
commit
e050c45530
|
@ -18,7 +18,7 @@ from loadcredential import Credentials
|
||||||
# Secrets
|
# Secrets
|
||||||
credentials = Credentials(env_prefix="GESTIOJEUX_")
|
credentials = Credentials(env_prefix="GESTIOJEUX_")
|
||||||
|
|
||||||
SECRET_KEY = credentials["SECRET_KEY"]
|
SECRET_KEY = credentials.get("SECRET_KEY", "insecure")
|
||||||
|
|
||||||
DEBUG = credentials.get_json(
|
DEBUG = credentials.get_json(
|
||||||
"DEBUG", False
|
"DEBUG", False
|
||||||
|
@ -32,8 +32,6 @@ ADMINS = credentials.get_json("ADMINS", [])
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
PUBLIC_DIR = os.path.join(BASE_DIR, "public")
|
PUBLIC_DIR = os.path.join(BASE_DIR, "public")
|
||||||
|
|
||||||
# Conditional settings
|
|
||||||
if DEBUG:
|
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||||
|
|
||||||
|
@ -44,25 +42,6 @@ if DEBUG:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Email
|
|
||||||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
|
||||||
else:
|
|
||||||
EMAIL_HOST = "clipper.ens.fr"
|
|
||||||
SERVER_EMAIL = credentials["SERVER_EMAIL"]
|
|
||||||
DEFAULT_FROM_EMAIL = credentials["DEFAULT_FROM_EMAIL"]
|
|
||||||
|
|
||||||
# HTTPS only
|
|
||||||
CSRF_COOKIE_SECURE = True
|
|
||||||
SESSION_COOKIE_SECURE = True
|
|
||||||
|
|
||||||
DATABASES = {
|
|
||||||
"default": {
|
|
||||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
|
||||||
"NAME": credentials["DB_NAME"],
|
|
||||||
"USER": credentials["DB_USER"],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Search engine
|
# Search engine
|
||||||
# https://django-haystack.readthedocs.io/en/latest/tutorial.html#configuration
|
# https://django-haystack.readthedocs.io/en/latest/tutorial.html#configuration
|
||||||
|
|
Loading…
Reference in a new issue