Skip to content

Commit

Permalink
removed overriding and if block in variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Manan Bhavsar committed Jul 13, 2023
1 parent 62ab1da commit 9887d24
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions {{cookiecutter.project_slug}}/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
# https://docs.djangoproject.com/en/dev/ref/middleware/#x-content-type-options-nosniff
SECURE_CONTENT_TYPE_NOSNIFF = env.bool("DJANGO_SECURE_CONTENT_TYPE_NOSNIFF", default=True)

STORAGES = dict()

{% if cookiecutter.cloud_provider != 'None' -%}
# STORAGES
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -105,49 +103,51 @@
{% endif -%}

{% if cookiecutter.cloud_provider != 'None' or cookiecutter.use_whitenoise == 'y' -%}
# STATIC
# STATIC & MEDIA
# ------------------------
{% endif -%}
{% if cookiecutter.use_whitenoise == 'y' -%}
STORAGES["staticfiles"] = {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
}
{% elif cookiecutter.cloud_provider == 'AWS' -%}
STORAGES["staticfiles"] = {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticRootS3Boto3Storage",
}
COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
STATIC_URL = f"https://{aws_s3_domain}/static/"
{% elif cookiecutter.cloud_provider == 'GCP' -%}
STORAGES["staticfiles"] = {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticRootGoogleCloudStorage",
}
COLLECTFAST_STRATEGY = "collectfast.strategies.gcloud.GoogleCloudStrategy"
STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
{% elif cookiecutter.cloud_provider == 'Azure' -%}
STORAGES["staticfiles"] = {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticRootAzureStorage",
STORAGES = {
{%- if cookiecutter.use_whitenoise == 'y' -%}
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
}
{%- elif cookiecutter.cloud_provider == 'AWS' -%}
"default": {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaRootS3Boto3Storage",
},
"staticfiles": {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticRootS3Boto3Storage",
}
{%- elif cookiecutter.cloud_provider == 'GCP' -%}
"default": {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaRootGoogleCloudStorage",
},
"staticfiles": {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticRootGoogleCloudStorage",
}
{%- elif cookiecutter.cloud_provider == 'Azure' -%}
"default": {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaRootAzureStorage",
},
"staticfiles": {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.StaticRootAzureStorage",
}
{%- endif -%}
}
STATIC_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/static/"
{% endif -%}
# MEDIA
# MEDIA_URL, STATIC_URL & COLLECTFAST_STRATEGY
# ------------------------------------------------------------------------------
{%- if cookiecutter.cloud_provider == 'AWS' %}
STORAGES["default"] = {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaRootS3Boto3Storage",
}
MEDIA_URL = f"https://{aws_s3_domain}/media/"
COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
STATIC_URL = f"https://{aws_s3_domain}/static/"
{%- elif cookiecutter.cloud_provider == 'GCP' %}
STORAGES["default"] = {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaRootGoogleCloudStorage",
}
MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
COLLECTFAST_STRATEGY = "collectfast.strategies.gcloud.GoogleCloudStrategy"
STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
{%- elif cookiecutter.cloud_provider == 'Azure' %}
STORAGES["default"] = {
"BACKEND": "{{cookiecutter.project_slug}}.utils.storages.MediaRootAzureStorage",
}
MEDIA_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/media/"
STATIC_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/static/"
{%- endif %}
# EMAIL
Expand Down

0 comments on commit 9887d24

Please sign in to comment.