From b06552e8165748fefcf5d1d61ef45ae99d8cc38b Mon Sep 17 00:00:00 2001 From: guntherweissenbaeck Date: Fri, 21 Jul 2023 17:12:45 +0000 Subject: [PATCH] settings that work in production mode --- app/core/settings.py | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/app/core/settings.py b/app/core/settings.py index 96168cf..9844ba7 100644 --- a/app/core/settings.py +++ b/app/core/settings.py @@ -16,17 +16,20 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = env("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = env("DEBUG") +# DEBUG = env("DEBUG") +DEBUG = False # CSRF Stuff CSRF_COOKIE_SECURE = True -CSRF_TRUSTED_ORIGINS = (env("CSRF_TRUSTED_ORIGINS"),) +# CSRF_TRUSTED_ORIGINS = ["https://*.nabu-jena.de", "https://*.127.0.0.1"] +CSRF_TRUSTED_ORIGINS = ["https://fbf.nabu-jena.de"] # Cookies SESSION_COOKIE_SECURE = True # Allowed Hosts -ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS", default=[]) +# ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS", default=[]) +ALLOWED_HOSTS = ["fbf.nabu-jena.de"] # Application definition @@ -155,26 +158,6 @@ USE_I18N = True USE_TZ = True -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.2/howto/static-files/ - -# STATIC_URL = "/static/" -# STATIC_ROOT = BASE_DIR / "static" -# STATICFILES_DIRS = [BASE_DIR / "static"] - -# STATIC_URL = "static/" -# STATICFILES_DIRS = [BASE_DIR / "static"] -# STATIC_ROOT = BASE_DIR / "staticfiles" -# STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.1/howto/static-files/ - -STATIC_URL = "static/" -STATICFILES_DIRS = [BASE_DIR / "static"] -STATIC_ROOT = BASE_DIR / 'staticfiles' -STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' - # Default primary key field type # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field @@ -330,11 +313,12 @@ JAZZMIN_SETTINGS = { # "language_chooser": True, } -CKEDITOR_BASEPATH = "/staticfiles/ckeditor/ckeditor/" +CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/" CKEDITOR_UPLOAD_PATH = "media" -# Local Settings -# try: -# from .opvars import * -# except ImportError: -# print('No Local Settings Found') +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.2/howto/static-files/ + +STATIC_URL = "static/" +STATICFILES_DIRS = [BASE_DIR / "static"] +STATIC_ROOT = BASE_DIR / "staticfiles"