mirror of
				https://github.com/more-tech4-magnum-opus/backend.git
				synced 2025-11-04 01:27:35 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			85 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
from .base import *  # noqa
 | 
						|
from .base import env
 | 
						|
 | 
						|
# GENERAL
 | 
						|
# ------------------------------------------------------------------------------
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
 | 
						|
SECRET_KEY = env("DJANGO_SECRET_KEY")
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
 | 
						|
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["example.com"])
 | 
						|
 | 
						|
# SECURITY
 | 
						|
# ------------------------------------------------------------------------------
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
 | 
						|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-ssl-redirect
 | 
						|
SECURE_SSL_REDIRECT = env.bool("DJANGO_SECURE_SSL_REDIRECT", default=True)
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure
 | 
						|
SESSION_COOKIE_SECURE = True
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-cookie-secure
 | 
						|
CSRF_COOKIE_SECURE = True
 | 
						|
# https://docs.djangoproject.com/en/dev/topics/security/#ssl-https
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-seconds
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-include-subdomains
 | 
						|
SECURE_HSTS_INCLUDE_SUBDOMAINS = env.bool(
 | 
						|
    "DJANGO_SECURE_HSTS_INCLUDE_SUBDOMAINS", default=True
 | 
						|
)
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-hsts-preload
 | 
						|
SECURE_HSTS_PRELOAD = env.bool("DJANGO_SECURE_HSTS_PRELOAD", default=True)
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff
 | 
						|
SECURE_CONTENT_TYPE_NOSNIFF = env.bool(
 | 
						|
    "DJANGO_SECURE_CONTENT_TYPE_NOSNIFF", default=True
 | 
						|
)
 | 
						|
 | 
						|
# STATIC
 | 
						|
# ------------------------
 | 
						|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
 | 
						|
# MEDIA
 | 
						|
# ------------------------------------------------------------------------------
 | 
						|
 | 
						|
 | 
						|
# LOGGING
 | 
						|
# ------------------------------------------------------------------------------
 | 
						|
# https://docs.djangoproject.com/en/dev/ref/settings/#logging
 | 
						|
# See https://docs.djangoproject.com/en/dev/topics/logging for
 | 
						|
# more details on how to customize your logging configuration.
 | 
						|
# A sample logging configuration. The only tangible logging
 | 
						|
# performed by this configuration is to send an email to
 | 
						|
# the site admins on every HTTP 500 error when DEBUG=False.
 | 
						|
LOGGING = {
 | 
						|
    "version": 1,
 | 
						|
    "disable_existing_loggers": False,
 | 
						|
    "filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
 | 
						|
    "formatters": {
 | 
						|
        "verbose": {
 | 
						|
            "format": "%(levelname)s %(asctime)s %(module)s "
 | 
						|
            "%(process)d %(thread)d %(message)s"
 | 
						|
        }
 | 
						|
    },
 | 
						|
    "handlers": {
 | 
						|
        "mail_admins": {
 | 
						|
            "level": "ERROR",
 | 
						|
            "filters": ["require_debug_false"],
 | 
						|
            "class": "django.utils.log.AdminEmailHandler",
 | 
						|
        },
 | 
						|
        "console": {
 | 
						|
            "level": "DEBUG",
 | 
						|
            "class": "logging.StreamHandler",
 | 
						|
            "formatter": "verbose",
 | 
						|
        },
 | 
						|
    },
 | 
						|
    "root": {"level": "INFO", "handlers": ["console"]},
 | 
						|
    "loggers": {
 | 
						|
        "django.request": {
 | 
						|
            "handlers": ["mail_admins"],
 | 
						|
            "level": "ERROR",
 | 
						|
            "propagate": True,
 | 
						|
        },
 | 
						|
        "django.security.DisallowedHost": {
 | 
						|
            "level": "ERROR",
 | 
						|
            "handlers": ["console", "mail_admins"],
 | 
						|
            "propagate": True,
 | 
						|
        },
 | 
						|
    },
 | 
						|
}
 |