mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-13 08:24:53 +03:00
Remove "Root" in our own storage class names
This commit is contained in:
parent
0dd11261c1
commit
85fada8b5a
|
@ -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.StaticRootS3Storage"
|
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.MediaRootS3Storage"
|
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 %}
|
||||||
|
|
||||||
|
|
|
@ -2,35 +2,35 @@
|
||||||
from storages.backends.s3 import S3Storage
|
from storages.backends.s3 import S3Storage
|
||||||
|
|
||||||
|
|
||||||
class StaticRootS3Storage(S3Storage):
|
class StaticS3Storage(S3Storage):
|
||||||
location = "static"
|
location = "static"
|
||||||
default_acl = "public-read"
|
default_acl = "public-read"
|
||||||
|
|
||||||
|
|
||||||
class MediaRootS3Storage(S3Storage):
|
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