Prepare settings and fix urls for aws s3 usage
This commit is contained in:
parent
8d6f9b57aa
commit
4eb8406b2c
|
|
@ -233,15 +233,16 @@ if not DEBUG:
|
|||
# AWS S3
|
||||
# http://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
|
||||
|
||||
# AWS_QUERYSTRING_AUTH = False
|
||||
# AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
|
||||
# AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
|
||||
# AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME')
|
||||
# AWS_S3_FILE_OVERWRITE = False
|
||||
USE_AWS = bool_value(os.environ.get('USE_AWS'))
|
||||
AWS_QUERYSTRING_AUTH = False
|
||||
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
|
||||
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
|
||||
AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME')
|
||||
AWS_S3_FILE_OVERWRITE = False
|
||||
|
||||
# use with cloudfront
|
||||
# AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
|
||||
if bool_value(os.environ.get('USE_AWS')):
|
||||
if USE_AWS:
|
||||
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||
# use with cloudfront
|
||||
# MEDIA_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
|
||||
|
|
|
|||
|
|
@ -20,10 +20,11 @@ urlpatterns = [
|
|||
url(r'^api/', include('api.urls', namespace="api")),
|
||||
]
|
||||
|
||||
if settings.DEBUG and not settings.USE_AWS:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(
|
||||
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL,
|
||||
document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
# actually we use the cms in headless mode but need the url pattern to get the wagtail_serve function
|
||||
urlpatterns += [url(r'pages/', include(wagtail_urls)), ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue