diff --git a/dumuzid/settings.py b/dumuzid/settings.py index f56550e..a48f78b 100644 --- a/dumuzid/settings.py +++ b/dumuzid/settings.py @@ -121,7 +121,24 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.1/howto/static-files/ -STATIC_URL = 'static/' +STATICFILES_DIRS = [ + BASE_DIR / "frontend/static/", +] + +STATIC_URL = '/static/' + +STATIC_ROOT = None if DEBUG else ASK.config.get("RESTOROO", "StaticRoot", fallback=BASE_DIR / "static") + +LOGIN_REDIRECT_URL = '/' +LOGOUT_REDIRECT_URL = "/" + +if "S3" in ASK.config: + DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' + STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage' + AWS_ACCESS_KEY_ID = ASK.config.get("S3", "AccessKey") + AWS_SECRET_ACCESS_KEY = ASK.config.get("S3", "SecretKey") + AWS_STORAGE_BUCKET_NAME = ASK.config.get("S3", "Bucket") + AWS_S3_ENDPOINT_URL = ASK.config.get("S3", "Endpoint") # Default primary key field type # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field diff --git a/requirements.txt b/requirements.txt index 219e6a0..8e2e9d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,9 @@ django-autosecretkey # For MySQL -mysqlclient \ No newline at end of file +mysqlclient + +# For S3 + +django-storages +boto3