Skip to content

Commit

Permalink
fix(vote): setup staticfiles s3 only debug is True
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Aug 23, 2024
1 parent 4c252fa commit d6e303b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/org_eleicoes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ WORKDIR /app
# Copy the source code of the project into the container.
COPY --from=node-builder /app ./

# RUN python manage.py collectstatic --noinput --clear -i tailwindcss
RUN python manage.py collectstatic --noinput --clear -i tailwindcss

# Runtime command that executes when "docker run" is called.

Expand Down
19 changes: 11 additions & 8 deletions app/org_eleicoes/votepeloclima/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@
#
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com"

PUBLIC_STATIC_LOCATION = "static"
#
PUBLIC_MEDIA_LOCATION = "media"

STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{PUBLIC_STATIC_LOCATION}/"
MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{PUBLIC_MEDIA_LOCATION}/"

STATICFILES_STORAGE = 'project.storages.PublicStaticStorage'
DEFAULT_FILE_STORAGE = "project.storages.PublicMediaStorage"

COMPRESS_STORAGE = STATICFILES_STORAGE
if not DEBUG:

COMPRESS_URL = STATIC_URL
PUBLIC_STATIC_LOCATION = "static"

PUBLIC_MEDIA_LOCATION = "media"
STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{PUBLIC_STATIC_LOCATION}/"

MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{PUBLIC_MEDIA_LOCATION}/"
STATICFILES_STORAGE = 'project.storages.PublicStaticStorage'

DEFAULT_FILE_STORAGE = "project.storages.PublicMediaStorage"
COMPRESS_STORAGE = STATICFILES_STORAGE

COMPRESS_URL = STATIC_URL

0 comments on commit d6e303b

Please sign in to comment.