Skip to content

Commit

Permalink
try to add config for s3
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Jul 25, 2024
1 parent a55947a commit 00639c7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
1 change: 0 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"compressor.finders.CompressorFinder",
]

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

STATICFILES_FINDERS += ["compressor.finders.CompressorFinder"]

Expand Down
3 changes: 3 additions & 0 deletions config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# For Docker env (and debug toolbar in particular)
import socket


_, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS = [ip[: ip.rfind(".")] + ".1" for ip in ips] + ["127.0.0.1"]

Expand Down Expand Up @@ -90,3 +91,5 @@
"results": True,
"store_none": True,
} # Huey implementation to use.

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
21 changes: 20 additions & 1 deletion config/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@
env = environ.Env()


STORAGES = {
"default": {
"BACKEND": "storages.backends.s3.S3Storage",
# "BACKEND": "lemarche.utils.s3boto.S3BotoStorage",
"OPTIONS": {
"bucket_name": S3_STORAGE_BUCKET_NAME, # noqa
"access_key": S3_STORAGE_ACCESS_KEY_ID, # noqa
"secret_key": S3_STORAGE_SECRET_ACCESS_KEY, # noqa
"endpoint_url": f"https://{S3_STORAGE_ENDPOINT_DOMAIN}", # noqa
"region_name": S3_STORAGE_BUCKET_REGION, # noqa
"file_overwrite": False,
"location": env.str("S3_LOCATION", ""),
},
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}


ALLOWED_HOSTS = [
"127.0.0.1",
"staging.inclusion.beta.gouv.fr",
Expand All @@ -24,7 +44,6 @@
SECURE_SSL_REDIRECT = env.bool("SECURE_SSL_REDIRECT", True)

MEDIA_URL = f"https://{S3_STORAGE_ENDPOINT_DOMAIN}/" # noqa
DEFAULT_FILE_STORAGE = "lemarche.utils.s3boto.S3BotoStorage"


# Sentry
Expand Down

0 comments on commit 00639c7

Please sign in to comment.