mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-25 16:00:47 +03:00
Merge pull request #1799 from umrashrf/b-fixed-s3-static-and-media-url-in-production-settings
Fixed S3 HTTP URL for /static and /media storages
This commit is contained in:
commit
64a4b598d8
|
@ -162,6 +162,7 @@ Listed in alphabetical order.
|
||||||
Tom Atkins `@knitatoms`_
|
Tom Atkins `@knitatoms`_
|
||||||
Tom Offermann
|
Tom Offermann
|
||||||
Travis McNeill `@Travistock`_ @tavistock_esq
|
Travis McNeill `@Travistock`_ @tavistock_esq
|
||||||
|
Umair Ashraf `@umrashrf`_ @fabumair
|
||||||
Vitaly Babiy
|
Vitaly Babiy
|
||||||
Vivian Guillen `@viviangb`_
|
Vivian Guillen `@viviangb`_
|
||||||
Will Farley `@goldhand`_ @g01dhand
|
Will Farley `@goldhand`_ @g01dhand
|
||||||
|
@ -276,6 +277,7 @@ Listed in alphabetical order.
|
||||||
.. _@pchiquet: https://github.com/pchiquet
|
.. _@pchiquet: https://github.com/pchiquet
|
||||||
.. _@delneg: https://github.com/delneg
|
.. _@delneg: https://github.com/delneg
|
||||||
.. _@purplediane: https://github.com/purplediane
|
.. _@purplediane: https://github.com/purplediane
|
||||||
|
.. _@umrashrf: https://github.com/umrashrf
|
||||||
Special Thanks
|
Special Thanks
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -87,14 +87,14 @@ AWS_S3_OBJECT_PARAMETERS = {
|
||||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||||
{%- else %}
|
{%- else %}
|
||||||
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3Boto3Storage'
|
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3Boto3Storage'
|
||||||
STATIC_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/static/'
|
STATIC_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/static/'
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# MEDIA
|
# MEDIA
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||||
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
|
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
|
||||||
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/'
|
MEDIA_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/'
|
||||||
{%- else %}
|
{%- else %}
|
||||||
# region http://stackoverflow.com/questions/10390244/
|
# region http://stackoverflow.com/questions/10390244/
|
||||||
# Full-fledge class: https://stackoverflow.com/a/18046120/104731
|
# Full-fledge class: https://stackoverflow.com/a/18046120/104731
|
||||||
|
@ -112,7 +112,7 @@ class MediaRootS3Boto3Storage(S3Boto3Storage):
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3Boto3Storage'
|
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3Boto3Storage'
|
||||||
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/media/'
|
MEDIA_URL = f'https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/media/'
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# TEMPLATES
|
# TEMPLATES
|
||||||
|
|
Loading…
Reference in New Issue
Block a user