mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-27 17:54:37 +03:00
Merge pull request #1780 from erfaan/1771-use-full-fledge-class-for-s3
1771 use full fledge class for s3
This commit is contained in:
commit
676e17029c
|
@ -103,6 +103,7 @@ Listed in alphabetical order.
|
|||
Hendrik Schneider `@hendrikschneider`_
|
||||
Henrique G. G. Pereira `@ikkebr`_
|
||||
Ian Lee `@IanLee1521`_
|
||||
Irfan Ahmad `@erfaan`_ @erfaan
|
||||
Jan Van Bruggen `@jvanbrug`_
|
||||
Jens Nilsson `@phiberjenz`_
|
||||
Jimmy Gitonga `@afrowave`_ @afrowave
|
||||
|
@ -205,6 +206,7 @@ Listed in alphabetical order.
|
|||
.. _@durkode: https://github.com/durkode
|
||||
.. _@epileptic-fish: https://gihub.com/epileptic-fish
|
||||
.. _@eraldo: https://github.com/eraldo
|
||||
.. _@erfaan: https://github.com/erfaan
|
||||
.. _@eriol: https://github.com/eriol
|
||||
.. _@eyadsibai: https://github.com/eyadsibai
|
||||
.. _@flyudvik: https://github.com/flyudvik
|
||||
|
|
|
@ -97,9 +97,19 @@ DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
|
|||
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/'
|
||||
{%- else %}
|
||||
# region http://stackoverflow.com/questions/10390244/
|
||||
# Full-fledge class: https://stackoverflow.com/a/18046120/104731
|
||||
from storages.backends.s3boto3 import S3Boto3Storage # noqa E402
|
||||
StaticRootS3BotoStorage = lambda: S3Boto3Storage(location='static') # noqa
|
||||
MediaRootS3BotoStorage = lambda: S3Boto3Storage(location='media', file_overwrite=False) # noqa
|
||||
|
||||
|
||||
class StaticRootS3BotoStorage(S3Boto3Storage):
|
||||
location = 'static'
|
||||
|
||||
|
||||
class MediaRootS3BotoStorage(S3Boto3Storage):
|
||||
location = 'media'
|
||||
file_overwrite = False
|
||||
|
||||
|
||||
# endregion
|
||||
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3BotoStorage'
|
||||
MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/media/'
|
||||
|
|
Loading…
Reference in New Issue
Block a user