diff --git a/requirements.txt b/requirements.txt index df69427..5e6f0c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -django==4.1.13 +django==4.2.13 psycopg2 django-storages[azure] argon2-cffi diff --git a/tenttiarkisto/settings/production.py b/tenttiarkisto/settings/production.py index 655b63c..df2e9a9 100644 --- a/tenttiarkisto/settings/production.py +++ b/tenttiarkisto/settings/production.py @@ -2,37 +2,46 @@ from django.core.exceptions import ImproperlyConfigured from tenttiarkisto.settings import * + def get_env_var(name): - value = environ.get(name) - if not value: - raise ImproperlyConfigured(f'Missing env variable: {name}') - return value + value = environ.get(name) + if not value: + raise ImproperlyConfigured(f"Missing env variable: {name}") + return value + DEBUG = False DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': get_env_var('DB_NAME'), - 'USER': get_env_var('DB_USER'), - 'PASSWORD': get_env_var('DB_PASSWORD'), - 'HOST': get_env_var('DB_HOST'), - 'PORT': environ.get('DB_PORT', ''), - 'OPTIONS': { 'sslmode': 'require' }, + "default": { + "ENGINE": "django.db.backends.postgresql_psycopg2", + "NAME": get_env_var("DB_NAME"), + "USER": get_env_var("DB_USER"), + "PASSWORD": get_env_var("DB_PASSWORD"), + "HOST": get_env_var("DB_HOST"), + "PORT": environ.get("DB_PORT", ""), + "OPTIONS": {"sslmode": "require"}, } } -DEFAULT_FILE_STORAGE = 'storages.backends.azure_storage.AzureStorage' +STORAGES = { + "default": { + "BACKEND": "storages.backends.azure_storage.AzureStorage", + }, + "staticfiles": { + "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage", + }, +} -AZURE_ACCOUNT_NAME = get_env_var('EXAM_ACCOUNT_NAME') -AZURE_ACCOUNT_KEY = get_env_var('EXAM_ACCOUNT_KEY') -AZURE_CONTAINER = get_env_var('EXAM_CONTAINER') +AZURE_ACCOUNT_NAME = get_env_var("EXAM_ACCOUNT_NAME") +AZURE_ACCOUNT_KEY = get_env_var("EXAM_ACCOUNT_KEY") +AZURE_CONTAINER = get_env_var("EXAM_CONTAINER") -SECRET_KEY = get_env_var('SECRET_KEY') +SECRET_KEY = get_env_var("SECRET_KEY") -ALLOWED_HOSTS = get_env_var('ALLOWED_HOSTS').split(',') +ALLOWED_HOSTS = get_env_var("ALLOWED_HOSTS").split(",") -SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") LOGGING = { "version": 1,