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
|
# AWS S3
|
||||||
# http://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
|
# http://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html
|
||||||
|
|
||||||
# AWS_QUERYSTRING_AUTH = False
|
USE_AWS = bool_value(os.environ.get('USE_AWS'))
|
||||||
# AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
|
AWS_QUERYSTRING_AUTH = False
|
||||||
# AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
|
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
|
||||||
# AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME')
|
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
|
||||||
# AWS_S3_FILE_OVERWRITE = False
|
AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME')
|
||||||
|
AWS_S3_FILE_OVERWRITE = False
|
||||||
|
|
||||||
# use with cloudfront
|
# use with cloudfront
|
||||||
# AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
|
# 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"
|
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
|
||||||
# use with cloudfront
|
# use with cloudfront
|
||||||
# MEDIA_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
|
# MEDIA_URL = "https://%s/" % AWS_S3_CUSTOM_DOMAIN
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ urlpatterns = [
|
||||||
url(r'^api/', include('api.urls', namespace="api")),
|
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:
|
if settings.DEBUG:
|
||||||
urlpatterns += static(
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + 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
|
# 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)), ]
|
urlpatterns += [url(r'pages/', include(wagtail_urls)), ]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue