forked from DGNum/gestiojeux
feat(FORK): Rework settings to be nicer for djangonix
This commit is contained in:
parent
3a730251d4
commit
e050c45530
1 changed files with 8 additions and 29 deletions
|
@ -18,7 +18,7 @@ from loadcredential import Credentials
|
|||
# Secrets
|
||||
credentials = Credentials(env_prefix="GESTIOJEUX_")
|
||||
|
||||
SECRET_KEY = credentials["SECRET_KEY"]
|
||||
SECRET_KEY = credentials.get("SECRET_KEY", "insecure")
|
||||
|
||||
DEBUG = credentials.get_json(
|
||||
"DEBUG", False
|
||||
|
@ -32,36 +32,15 @@ ADMINS = credentials.get_json("ADMINS", [])
|
|||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
PUBLIC_DIR = os.path.join(BASE_DIR, "public")
|
||||
|
||||
# Conditional settings
|
||||
if DEBUG:
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
# 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"],
|
||||
}
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Search engine
|
||||
|
|
Loading…
Add table
Reference in a new issue