Skip to content

Commit

Permalink
Streamline django storages config (#618)
Browse files Browse the repository at this point in the history
* Add staticfiles

* Fix AWS bucket routing for boto

* Try setting credentials through env vars

* Try renaming env vars?

* Set AWS region

* add back staticfiles

* Remove region and signature version

* Move credentials to new API

* Use env variables and remove staticfiles

* Add back staticfiles

* Make code look pretty

---------

Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com>
  • Loading branch information
aviupadhyayula and rm03 committed Mar 9, 2024
1 parent 79c3f79 commit 813cd4b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions backend/pennclubs/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@
# Upload file storage
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY")
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME")
AWS_DEFAULT_ACL = "public-read"
AWS_QUERYSTRING_AUTH = False

STORAGES = {
"default": {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"bucket_name": os.getenv("AWS_STORAGE_BUCKET_NAME"),
"default_acl": "public-read",
"querystring_auth": False,
},
},
"default": {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"},
"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
}

Expand Down

0 comments on commit 813cd4b

Please sign in to comment.