2020-02-18 20:30:26 +00:00
|
|
|
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-03-11 12:24:48 +00:00
|
|
|
import os
|
|
|
|
|
2020-01-27 20:49:02 +00:00
|
|
|
########################
|
|
|
|
# Production Settings #
|
|
|
|
########################
|
|
|
|
# For local dev on your machine:
|
|
|
|
# - Enabled by setting env variable DJANGO_APP_STAGE = 'prod'
|
|
|
|
# - use Postgresql as db engine
|
|
|
|
# - Debug should be false.
|
|
|
|
# - should have a dedicated mail server
|
|
|
|
# - and more ...
|
|
|
|
|
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
2020-01-28 19:56:04 +00:00
|
|
|
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
2020-03-11 14:54:12 +00:00
|
|
|
'NAME': os.environ.get('DJANGO_DB_NAME', 'note_db'),
|
|
|
|
'USER': os.environ.get('DJANGO_DB_USER', 'note'),
|
|
|
|
'PASSWORD': os.environ.get('DJANGO_DB_PASSWORD', 'CHANGE_ME_IN_ENV_SETTINGS'),
|
|
|
|
'HOST': os.environ.get('DJANGO_DB_HOST', 'localhost'),
|
|
|
|
'PORT': os.environ.get('DJANGO_DB_PORT', ''), # Use default port
|
2020-01-27 20:49:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Break it, fix it!
|
2020-07-25 17:14:27 +00:00
|
|
|
DEBUG = False
|
2020-01-27 20:49:02 +00:00
|
|
|
|
|
|
|
# Mandatory !
|
2020-03-11 14:54:12 +00:00
|
|
|
ALLOWED_HOSTS = [os.environ.get('NOTE_URL', 'localhost')]
|
|
|
|
|
|
|
|
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'CHANGE_ME_IN_ENV_SETTINGS')
|
2020-01-27 20:49:02 +00:00
|
|
|
|
|
|
|
# Emails
|
2020-05-08 13:59:31 +00:00
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
|
|
EMAIL_USE_SSL = False
|
|
|
|
EMAIL_HOST = os.getenv('EMAIL_HOST', 'smtp.example.org')
|
2020-07-25 17:14:27 +00:00
|
|
|
EMAIL_PORT = os.getenv('EMAIL_PORT', 465)
|
2020-07-28 16:59:34 +00:00
|
|
|
EMAIL_HOST_USER = os.getenv('EMAIL_USER', None)
|
|
|
|
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_PASSWORD', None)
|
2020-05-08 13:59:31 +00:00
|
|
|
|
|
|
|
SERVER_EMAIL = os.getenv("NOTE_MAIL", "notekfet@example.com")
|
2020-07-28 16:59:34 +00:00
|
|
|
DEFAULT_FROM_EMAIL = "NoteKfet2020 <" + SERVER_EMAIL + ">"
|
2020-01-27 20:49:02 +00:00
|
|
|
|
|
|
|
# Security settings
|
|
|
|
SECURE_CONTENT_TYPE_NOSNIFF = False
|
|
|
|
SECURE_BROWSER_XSS_FILTER = False
|
|
|
|
SESSION_COOKIE_SECURE = False
|
|
|
|
CSRF_COOKIE_SECURE = False
|
|
|
|
CSRF_COOKIE_HTTPONLY = False
|
|
|
|
X_FRAME_OPTIONS = 'DENY'
|
|
|
|
SESSION_COOKIE_AGE = 60 * 60 * 3
|