From 74a5cf7cbf10d9ea63943b7f8efa581e29b4e063 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 2 Feb 2024 01:00:05 +0100 Subject: [PATCH] Add Django local parameters --- .gitignore | 1 + sncf/settings.py | 12 ++++++++++-- sncf/settings_local_example.py | 20 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 sncf/settings_local_example.py diff --git a/.gitignore b/.gitignore index b0c7f81..2a81894 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ coverage # Local data secrets.py +settings_local.py *.log media/ output/ diff --git a/sncf/settings.py b/sncf/settings.py index 13619f5..7b3d7c4 100644 --- a/sncf/settings.py +++ b/sncf/settings.py @@ -22,7 +22,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure-&900+#-_$xydt$nz3xe_6pe&*f#=7hiqal6@ndtt7v2oixhu@y" +SECRET_KEY = "CHANGE ME" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -135,7 +135,9 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.0/howto/static-files/ -STATIC_URL = "static/" +STATIC_URL = "api-static/" + +STATIC_ROOT = BASE_DIR / "static_files" # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field @@ -147,3 +149,9 @@ REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 20, } + + +try: + from settings_local import * +except ImportError: + pass diff --git a/sncf/settings_local_example.py b/sncf/settings_local_example.py new file mode 100644 index 0000000..fafcabf --- /dev/null +++ b/sncf/settings_local_example.py @@ -0,0 +1,20 @@ +SECRET_KEY = "CHANGE ME" + +DEBUG = False + +ALLOW_HOSTS = ['sncf.emy.lu'] + +CORS_ALLOWED_ORIGINS = [ + "https://sncf.emy.lu", +] + +DATABASES = { + "default": { + "ENGINE": "django.db.backends.postgresql", + "NAME": "sncf", + "USER": "sncf", + "PASSWORD": "CHANGE ME", + "HOST": "localhost", + "PORT": "5432", + } +}