Repository: cookiecutter/cookiecutter-django

Issue:
No staticfile storage with GCP without Whitenoise
## What happened?

If the user chooses GCP as cloud provider & no Whitenoise, then `STATICFILES_STORAGE` is unset in production.

https://github.com/pydanny/cookiecutter-django/blob/164e2aa69c2bf58104de7ad3474d89995329b8b5/%7B%7Bcookiecutter.project_slug%7D%7D/config/settings/production.py#L104-L111


## What should've happened instead?

The `STATICFILES_STORAGE` setting should be set to `"storages.backends.gcloud.GoogleCloudStorage"` or a subclass.

## Steps to reproduce

Reproducible using:

`cookiecutter https://github.com/pydanny/cookiecutter-django use_whitenoise=n cloud_provider=GCP`

No staticfile storage with GCP without Whitenoise
## What happened?

If the user chooses GCP as cloud provider & no Whitenoise, then `STATICFILES_STORAGE` is unset in production.

https://github.com/pydanny/cookiecutter-django/blob/164e2aa69c2bf58104de7ad3474d89995329b8b5/%7B%7Bcookiecutter.project_slug%7D%7D/config/settings/production.py#L104-L111


## What should've happened instead?

The `STATICFILES_STORAGE` setting should be set to `"storages.backends.gcloud.GoogleCloudStorage"` or a subclass.

## Steps to reproduce

Reproducible using:

`cookiecutter https://github.com/pydanny/cookiecutter-django use_whitenoise=n cloud_provider=GCP`



Discussion:
@browniebroke I'll be working on this one
@browniebroke I'll be working on this one

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py
--- a/{{cookiecutter.project_slug}}/config/settings/production.py
+++ b/{{cookiecutter.project_slug}}/config/settings/production.py
@@ -92,7 +92,6 @@
 # https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html#settings
 AWS_S3_REGION_NAME = env("DJANGO_AWS_S3_REGION_NAME", default=None)
 {% elif cookiecutter.cloud_provider == 'GCP' %}
-DEFAULT_FILE_STORAGE = "storages.backends.gcloud.GoogleCloudStorage"
 GS_BUCKET_NAME = env("DJANGO_GCP_STORAGE_BUCKET_NAME")
 GS_DEFAULT_ACL = "publicRead"
 {% endif -%}
@@ -107,6 +106,7 @@
 STATICFILES_STORAGE = "config.settings.production.StaticRootS3Boto3Storage"
 STATIC_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/static/"
 {% elif cookiecutter.cloud_provider == 'GCP' -%}
+STATICFILES_STORAGE = "config.settings.production.StaticRootGoogleCloudStorage"
 STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
 {% endif -%}
 
@@ -132,8 +132,21 @@ class MediaRootS3Boto3Storage(S3Boto3Storage):
 DEFAULT_FILE_STORAGE = "config.settings.production.MediaRootS3Boto3Storage"
 MEDIA_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/media/"
 {%- elif cookiecutter.cloud_provider == 'GCP' %}
+from storages.backends.gcloud import GoogleCloudStorage  # noqa E402
+
+
+class StaticRootGoogleCloudStorage(GoogleCloudStorage):
+    location = "static"
+    default_acl = "publicRead"
+
+
+class MediaRootGoogleCloudStorage(GoogleCloudStorage):
+    location = "media"
+    file_overwrite = False
+
+
+DEFAULT_FILE_STORAGE = "config.settings.production.MediaRootGoogleCloudStorage"
 MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
-MEDIA_ROOT = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
 {%- endif %}
 
 # TEMPLATES


Test patch: