Skip to content

Commit

Permalink
improve_settings_and_fix_mypy_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DTodorov985 authored and RadoRado committed May 12, 2024
1 parent f4dd56b commit 704cd57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
7 changes: 0 additions & 7 deletions config/django/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,6 @@

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
STATIC_URL = "/static/"
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

REST_FRAMEWORK = {
"EXCEPTION_HANDLER": "styleguide_example.api.exception_handlers.drf_default_with_modifications_exception_handler",
# 'EXCEPTION_HANDLER': 'styleguide_example.api.exception_handlers.hacksoft_proposed_exception_handler',
Expand Down
15 changes: 14 additions & 1 deletion config/settings/files_and_storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
from config.env import BASE_DIR, env, env_to_enum
from styleguide_example.files.enums import FileUploadStorage, FileUploadStrategy


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
STATIC_URL = "/static/"
STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage"},
}


FILE_UPLOAD_STRATEGY = env_to_enum(FileUploadStrategy, env("FILE_UPLOAD_STRATEGY", default="standard"))
FILE_UPLOAD_STORAGE = env_to_enum(FileUploadStorage, env("FILE_UPLOAD_STORAGE", default="local"))

Expand All @@ -16,7 +29,7 @@
if FILE_UPLOAD_STORAGE == FileUploadStorage.S3:
# Using django-storages
# https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
STORAGES["default"] = {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"}

AWS_S3_ACCESS_KEY_ID = env("AWS_S3_ACCESS_KEY_ID")
AWS_S3_SECRET_ACCESS_KEY = env("AWS_S3_SECRET_ACCESS_KEY")
Expand Down

0 comments on commit 704cd57

Please sign in to comment.