Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- with open('/etc/secret_key.txt') as f:
- SECRET_KEY = f.read().strip()
- DEBUG = False
- ALLOWED_HOSTS = ['xxxxxx.com']
- SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
- SESSION_ENGINE = 'user_sessions.backends.db'
- CSRF_COOKIE_SECURE = True
- CSRF_COOKIE_SAMESITE = 'Strict'
- CSRF_COOKIE_AGE = None
- CSRF_COOKIE_DOMAIN = None
- CSRF_USE_SESSIONS = False
- CSRF_COOKIE_HTTPONLY = True
- SESSION_COOKIE_PATH = '/;HttpOnly'
- SESSION_COOKIE_HTTPONLY = True
- SESSION_COOKIE_SECURE = True
- SESSION_COOKIE_SAMESITE = 'Strict'
- SESSION_EXPIRE_AT_BROWSER_CLOSE = True
- SECURE_SSL_REDIRECT = True
- SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
- SECURE_BROWSER_XSS_FILTER = True
- SECURE_CONTENT_TYPE_NOSNIFF = True
- SECURE_HSTS_SECONDS = 15768000 #3600 # 1 day
- SECURE_HSTS_INCLUDE_SUBDOMAINS = True
- SECURE_HSTS_PRELOAD = True
- SECURE_FRAME_DENY = True
- X_FRAME_OPTIONS = 'DENY'
- os.environ['HTTPS'] = "on"
- os.environ['wsgi.url_scheme'] = 'https'
- CSP_DEFAULT_SRC = ("'none'",)
- CSP_STYLE_SRC = ("'self'", "xxxxxx.com", "fonts.googleapis.com", "'sha256-Y/OYzipjX3yzIdTnBrtEgSVTJ9PGTp7jDHMb+R3S1qI='")
- CSP_SCRIPT_SRC = ("'self'", "xxxxxx.com", "www.googletagmanager.com", "www.google-analytics.com", "https://www.google.com/recaptcha/", "https://www.gstatic.com/recaptcha/",)
- CSP_IMG_SRC = ("'self'", "data:", "www.googletagmanager.com", "www.google-analytics.com", "fonts.googleapis.com/")
- CSP_FONT_SRC = ("'self'", "xxxxxx.com", "fonts.gstatic.com")
- CSP_CONNECT_SRC = ("'self'", "xxxxxx.com",)
- CSP_OBJECT_SRC = ("'none'", )
- CSP_BASE_URI = ("'none'", )
- CSP_FRAME_SRC = ("'self'", "https://www.google.com/recaptcha/",)
- CSP_FRAME_ANCESTORS = ("'none'",)
- CSP_FORM_ACTION = ("'self'", "xxxxxx.com",)
- CSP_INCLUDE_NONCE_IN = ('script-src',)
- INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'user_sessions',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'captcha',
- 'usuario',
- 'administrador',
- 'base',
- 'django_otp',
- 'django_otp.plugins.otp_static',
- 'django_otp.plugins.otp_totp',
- 'two_factor',
- 'bootstrapform',
- ]
- MIDDLEWARE = [
- 'django.middleware.security.SecurityMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.common.CommonMiddleware',
- 'django.middleware.csrf.CsrfViewMiddleware',
- 'django.middleware.locale.LocaleMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'user_sessions.middleware.SessionMiddleware',
- 'django.contrib.messages.middleware.MessageMiddleware',
- 'django.middleware.clickjacking.XFrameOptionsMiddleware',
- 'csp.middleware.CSPMiddleware',
- 'django_otp.middleware.OTPMiddleware',
- 'two_factor.middleware.threadlocals.ThreadLocals',
- 'django_feature_policy.FeaturePolicyMiddleware',
- 'django_referrer_policy.middleware.ReferrerPolicyMiddleware',
- #'x_forwarded_for.middleware.XForwardedForMiddleware',
- ]
- AUTHENTICATION_BACKENDS = (
- 'django.contrib.auth.backends.ModelBackend',
- )
- REFERRER_POLICY = 'same-origin'
- FEATURE_POLICY = {
- 'geolocation': 'none',
- }
- LOGOUT_REDIRECT_URL = 'login'
- LOGIN_URL = 'login'
- LOGIN_REDIRECT_URL = 'home_usuario'
- RECAPTCHA_PUBLIC_KEY = 'xxxxxxxxxxxxxxxxxxx'
- RECAPTCHA_PRIVATE_KEY = 'xxxxxxxxxxxxxxxxxxx'
- ROOT_URLCONF = 'xxxxxxproject.urls'
- TEMPLATES = [
- {
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': ['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',
- ],
- },
- },
- ]
- WSGI_APPLICATION = 'xxxxxxproject.wsgi.application'
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.postgresql_psycopg2',
- 'NAME': 'xxxxxxproject',
- 'USER': 'xxxxxxprojectuser',
- 'PASSWORD': 'xxxxxxxxxxxxx',
- 'HOST': 'xxxxxxxxxxxx',
- 'PORT': '5432',
- }
- }
- AUTH_PASSWORD_VALIDATORS = [
- {
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
- },
- {
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
- },
- ]
- LANGUAGE_CODE = 'en-us'
- TIME_ZONE = 'UTC'
- USE_I18N = True
- USE_L10N = True
- USE_TZ = True
- EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
- EMAIL_USE_TLS = True
- EMAIL_HOST = 'smtp.1and1.es'
- EMAIL_HOST_USER = 'xxxxxxxx@xxxxxxx.xxx'
- EMAIL_HOST_PASSWORD = 'xxxxxxxxxxxxxxxxxxxxx'
- EMAIL_PORT = 587
- STATIC_URL = '/static/'
- STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
- os.environ['HTTPS'] = "on"
- os.environ['wsgi.url_scheme'] = 'https'
- try:
- from .settings_private import * # noqa
- except ImportError:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement