mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-06-20 13:33:07 +03:00
Update django-storages to 1.14 (#4564)
* Update django-storages from 1.13.2 to 1.14 * Update django-storages from 1.13.2 to 1.14 * Update django-storages from 1.13.2 to 1.14 * Migrate to new namespace for S3 Storage class * Update extra require for django-storages * Rename our subclasses for S3Storage to match parent naming * Remove "Root" in our own storage class names --------- Co-authored-by: Bruno Alla <alla.brunoo@gmail.com> Co-authored-by: Bruno Alla <browniebroke@users.noreply.github.com>
This commit is contained in:
parent
9e8e87c39b
commit
c27a9a8454
|
@ -109,28 +109,28 @@ AZURE_CONTAINER = env("DJANGO_AZURE_CONTAINER_NAME")
|
||||||
{% if cookiecutter.use_whitenoise == 'y' -%}
|
{% if cookiecutter.use_whitenoise == 'y' -%}
|
||||||
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||||
{% elif cookiecutter.cloud_provider == 'AWS' -%}
|
{% elif cookiecutter.cloud_provider == 'AWS' -%}
|
||||||
STATICFILES_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.StaticRootS3Boto3Storage"
|
STATICFILES_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.StaticS3Storage"
|
||||||
COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
|
COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
|
||||||
STATIC_URL = f"https://{aws_s3_domain}/static/"
|
STATIC_URL = f"https://{aws_s3_domain}/static/"
|
||||||
{% elif cookiecutter.cloud_provider == 'GCP' -%}
|
{% elif cookiecutter.cloud_provider == 'GCP' -%}
|
||||||
STATICFILES_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.StaticRootGoogleCloudStorage"
|
STATICFILES_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.StaticGoogleCloudStorage"
|
||||||
COLLECTFAST_STRATEGY = "collectfast.strategies.gcloud.GoogleCloudStrategy"
|
COLLECTFAST_STRATEGY = "collectfast.strategies.gcloud.GoogleCloudStrategy"
|
||||||
STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
|
STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
|
||||||
{% elif cookiecutter.cloud_provider == 'Azure' -%}
|
{% elif cookiecutter.cloud_provider == 'Azure' -%}
|
||||||
STATICFILES_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.StaticRootAzureStorage"
|
STATICFILES_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.StaticAzureStorage"
|
||||||
STATIC_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/static/"
|
STATIC_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/static/"
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
# MEDIA
|
# MEDIA
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
||||||
DEFAULT_FILE_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.MediaRootS3Boto3Storage"
|
DEFAULT_FILE_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.MediaS3Storage"
|
||||||
MEDIA_URL = f"https://{aws_s3_domain}/media/"
|
MEDIA_URL = f"https://{aws_s3_domain}/media/"
|
||||||
{%- elif cookiecutter.cloud_provider == 'GCP' %}
|
{%- elif cookiecutter.cloud_provider == 'GCP' %}
|
||||||
DEFAULT_FILE_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.MediaRootGoogleCloudStorage"
|
DEFAULT_FILE_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.MediaGoogleCloudStorage"
|
||||||
MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
|
MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
|
||||||
{%- elif cookiecutter.cloud_provider == 'Azure' %}
|
{%- elif cookiecutter.cloud_provider == 'Azure' %}
|
||||||
DEFAULT_FILE_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.MediaRootAzureStorage"
|
DEFAULT_FILE_STORAGE = "{{cookiecutter.project_slug}}.utils.storages.MediaAzureStorage"
|
||||||
MEDIA_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/media/"
|
MEDIA_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/media/"
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ hiredis==2.2.3 # https://github.com/redis/hiredis-py
|
||||||
# Django
|
# Django
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
{%- if cookiecutter.cloud_provider == 'AWS' %}
|
||||||
django-storages[boto3]==1.13.2 # https://github.com/jschneier/django-storages
|
django-storages[s3]==1.14 # https://github.com/jschneier/django-storages
|
||||||
{%- elif cookiecutter.cloud_provider == 'GCP' %}
|
{%- elif cookiecutter.cloud_provider == 'GCP' %}
|
||||||
django-storages[google]==1.13.2 # https://github.com/jschneier/django-storages
|
django-storages[google]==1.14 # https://github.com/jschneier/django-storages
|
||||||
{%- elif cookiecutter.cloud_provider == 'Azure' %}
|
{%- elif cookiecutter.cloud_provider == 'Azure' %}
|
||||||
django-storages[azure]==1.13.2 # https://github.com/jschneier/django-storages
|
django-storages[azure]==1.14 # https://github.com/jschneier/django-storages
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if cookiecutter.mail_service == 'Mailgun' %}
|
{%- if cookiecutter.mail_service == 'Mailgun' %}
|
||||||
django-anymail[mailgun]==10.1 # https://github.com/anymail/django-anymail
|
django-anymail[mailgun]==10.1 # https://github.com/anymail/django-anymail
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
{% if cookiecutter.cloud_provider == 'AWS' -%}
|
{% if cookiecutter.cloud_provider == 'AWS' -%}
|
||||||
from storages.backends.s3boto3 import S3Boto3Storage
|
from storages.backends.s3 import S3Storage
|
||||||
|
|
||||||
|
|
||||||
class StaticRootS3Boto3Storage(S3Boto3Storage):
|
class StaticS3Storage(S3Storage):
|
||||||
location = "static"
|
location = "static"
|
||||||
default_acl = "public-read"
|
default_acl = "public-read"
|
||||||
|
|
||||||
|
|
||||||
class MediaRootS3Boto3Storage(S3Boto3Storage):
|
class MediaS3Storage(S3Storage):
|
||||||
location = "media"
|
location = "media"
|
||||||
file_overwrite = False
|
file_overwrite = False
|
||||||
{%- elif cookiecutter.cloud_provider == 'GCP' -%}
|
{%- elif cookiecutter.cloud_provider == 'GCP' -%}
|
||||||
from storages.backends.gcloud import GoogleCloudStorage
|
from storages.backends.gcloud import GoogleCloudStorage
|
||||||
|
|
||||||
|
|
||||||
class StaticRootGoogleCloudStorage(GoogleCloudStorage):
|
class StaticGoogleCloudStorage(GoogleCloudStorage):
|
||||||
location = "static"
|
location = "static"
|
||||||
default_acl = "publicRead"
|
default_acl = "publicRead"
|
||||||
|
|
||||||
|
|
||||||
class MediaRootGoogleCloudStorage(GoogleCloudStorage):
|
class MediaGoogleCloudStorage(GoogleCloudStorage):
|
||||||
location = "media"
|
location = "media"
|
||||||
file_overwrite = False
|
file_overwrite = False
|
||||||
{%- elif cookiecutter.cloud_provider == 'Azure' -%}
|
{%- elif cookiecutter.cloud_provider == 'Azure' -%}
|
||||||
from storages.backends.azure_storage import AzureStorage
|
from storages.backends.azure_storage import AzureStorage
|
||||||
|
|
||||||
|
|
||||||
class StaticRootAzureStorage(AzureStorage):
|
class StaticAzureStorage(AzureStorage):
|
||||||
location = "static"
|
location = "static"
|
||||||
|
|
||||||
|
|
||||||
class MediaRootAzureStorage(AzureStorage):
|
class MediaAzureStorage(AzureStorage):
|
||||||
location = "media"
|
location = "media"
|
||||||
file_overwrite = False
|
file_overwrite = False
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user