mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-01-24 16:24:14 +03:00
Update file storages and put them in separate folders
This commit is contained in:
parent
b368dd7e36
commit
bd39eddf77
|
@ -97,7 +97,6 @@ INSTALLED_APPS += ("gunicorn", )
|
||||||
INSTALLED_APPS += (
|
INSTALLED_APPS += (
|
||||||
'storages',
|
'storages',
|
||||||
)
|
)
|
||||||
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
|
||||||
|
|
||||||
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
|
AWS_ACCESS_KEY_ID = env('DJANGO_AWS_ACCESS_KEY_ID')
|
||||||
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
|
AWS_SECRET_ACCESS_KEY = env('DJANGO_AWS_SECRET_ACCESS_KEY')
|
||||||
|
@ -122,6 +121,12 @@ AWS_HEADERS = {
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||||
MEDIA_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
|
MEDIA_URL = 'https://s3.amazonaws.com/%s/' % AWS_STORAGE_BUCKET_NAME
|
||||||
{% else %}
|
{% else %}
|
||||||
|
# See:http://stackoverflow.com/questions/10390244/
|
||||||
|
from storages.backends.s3boto import S3BotoStorage
|
||||||
|
StaticRootS3BotoStorage = lambda: S3BotoStorage(location='static')
|
||||||
|
MediaRootS3BotoStorage = lambda: S3BotoStorage(location='media')
|
||||||
|
DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3BotoStorage'
|
||||||
|
|
||||||
MEDIA_URL = 'https://s3.amazonaws.com/%s/media/' % AWS_STORAGE_BUCKET_NAME
|
MEDIA_URL = 'https://s3.amazonaws.com/%s/media/' % AWS_STORAGE_BUCKET_NAME
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
@ -130,8 +135,8 @@ MEDIA_URL = 'https://s3.amazonaws.com/%s/media/' % AWS_STORAGE_BUCKET_NAME
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||||
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
|
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
|
||||||
{% else %}
|
{% else %}
|
||||||
STATICFILES_STORAGE = DEFAULT_FILE_STORAGE
|
|
||||||
STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME
|
STATIC_URL = 'https://s3.amazonaws.com/%s/static/' % AWS_STORAGE_BUCKET_NAME
|
||||||
|
STATICFILES_STORAGE = 'config.settings.production.StaticRootS3BotoStorage'
|
||||||
|
|
||||||
# See: https://github.com/antonagestam/collectfast
|
# See: https://github.com/antonagestam/collectfast
|
||||||
# For Django 1.7+, 'collectfast' should come before
|
# For Django 1.7+, 'collectfast' should come before
|
||||||
|
|
Loading…
Reference in New Issue
Block a user