Repository: cookiecutter/cookiecutter-django

Issue:
Selecting Whitenoise and AWS as cloud provider overrides STATIC_URL in a way that assumes Collectfast
## What happened?

I had selected Whitenoise as my static asset solution, but also chose AWS as my cloud provider. This is because I want to use Whitenoise for static assets, but AWS for uploaded media. But essentially, these two selections halfway implemented Collectfast with AWS, but did not fully make the solution work. Neither Whitenoise or Cloud static assets worked when both are selected.

## What should've happened instead?

If Whitenoise is selected, AWS should only apply to media instead of static assets. Or, alternatively, by choosing AWS, it should also setup Collectfast so that this solution works. By choosing both Whitenoise and AWS, static asset generation is completely broken.

By choosing both, this is what `production.py` settings are generated:

```python
# STATIC & MEDIA
# ------------------------
STORAGES = {
    "default": {
        "BACKEND": "django.core.files.storage.FileSystemStorage",
    },
    "staticfiles": {
        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
    },
}
MEDIA_URL = f"https://{aws_s3_domain}/media/"
COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
STATIC_URL = f"https://{aws_s3_domain}/static/"
```

But `Collectfast` is not installed because `Whitenoise` was selected.

## Additional details


- Host system configuration:

  - Cookiecutter 2.5.0
  - This was found on a Heroku deployment when static assets were not working correctly.
  - Python 3.11.4

```json
{
  "cookiecutter": {
    "project_name": "Project",
    "project_slug": "project_slug",
    "description": "This project is a website.",
    "author_name": "Jason",
    "domain_name": "example.com",
    "email": "jason@example.com",
    "version": "0.1.0",
    "open_source_license": "Not open source",
    "username_type": "email",
    "timezone": "UTC",
    "windows": "n",
    "editor": "VS Code",
    "use_docker": "n",
    "postgresql_version": "12",
    "cloud_provider": "AWS",
    "mail_service": "Mailgun",
    "use_async": "n",
    "use_drf": "y",
    "frontend_pipeline": "Gulp",
    "use_celery": "n",
    "use_mailpit": "n",
    "use_sentry": "y",
    "use_whitenoise": "y",
    "use_heroku": "y",
    "ci_tool": "Github",
    "keep_local_envs_in_vcs": "y",
    "debug": "n",
    "_template": "gh:cookiecutter/cookiecutter-django",
    "_output_dir": "/Users/jason/Sites",
    "_repo_dir": "/Users/jason/.cookiecutters/cookiecutter-django",
    "_checkout": null
  }
```


Discussion:
Sounds like a bug indeed, agree that it is not expected. Would you like to send us a pull request to fix it? 
Hit this issue also, should be easy to fix. 

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
@@ -118,7 +118,7 @@
 # STATIC & MEDIA
 # ------------------------
 STORAGES = {
-{%- if cookiecutter.use_whitenoise == 'y' %}
+{%- if cookiecutter.use_whitenoise == 'y' and cookiecutter.cloud_provider == 'None' %}
     "default": {
         "BACKEND": "django.core.files.storage.FileSystemStorage",
     },
@@ -133,6 +133,11 @@
             "file_overwrite": False,
         },
     },
+    {%- if cookiecutter.use_whitenoise == 'y' %}
+    "staticfiles": {
+        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
+    },
+    {%- else %}
     "staticfiles": {
         "BACKEND": "storages.backends.s3.S3Storage",
         "OPTIONS": {
@@ -140,6 +145,7 @@
             "default_acl": "public-read",
         },
     },
+    {%- endif %}
 {%- elif cookiecutter.cloud_provider == 'GCP' %}
     "default": {
         "BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
@@ -148,6 +154,11 @@
             "file_overwrite": False,
         },
     },
+    {%- if cookiecutter.use_whitenoise == 'y' %}
+    "staticfiles": {
+        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
+    },
+    {%- else %}
     "staticfiles": {
         "BACKEND": "storages.backends.gcloud.GoogleCloudStorage",
         "OPTIONS": {
@@ -155,6 +166,7 @@
             "default_acl": "publicRead",
         },
     },
+    {%- endif %}
 {%- elif cookiecutter.cloud_provider == 'Azure' %}
     "default": {
         "BACKEND": "storages.backends.azure_storage.AzureStorage",
@@ -163,28 +175,40 @@
             "file_overwrite": False,
         },
     },
+    {%- if cookiecutter.use_whitenoise == 'y' %}
+    "staticfiles": {
+        "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
+    },
+    {%- else %}
     "staticfiles": {
         "BACKEND": "storages.backends.azure_storage.AzureStorage",
         "OPTIONS": {
             "location": "static",
         },
     },
+    {%- endif %}
 {%- endif %}
 }
 {%- endif %}
 
 {%- if cookiecutter.cloud_provider == 'AWS' %}
 MEDIA_URL = f"https://{aws_s3_domain}/media/"
+{%- if cookiecutter.use_whitenoise == 'n' %}
 COLLECTFAST_STRATEGY = "collectfast.strategies.boto3.Boto3Strategy"
 STATIC_URL = f"https://{aws_s3_domain}/static/"
+{%- endif %}
 {%- elif cookiecutter.cloud_provider == 'GCP' %}
 MEDIA_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/media/"
+{%- if cookiecutter.use_whitenoise == 'n' %}
 COLLECTFAST_STRATEGY = "collectfast.strategies.gcloud.GoogleCloudStrategy"
 STATIC_URL = f"https://storage.googleapis.com/{GS_BUCKET_NAME}/static/"
+{%- endif %}
 {%- elif cookiecutter.cloud_provider == 'Azure' %}
 MEDIA_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/media/"
+{%- if cookiecutter.use_whitenoise == 'n' %}
 STATIC_URL = f"https://{AZURE_ACCOUNT_NAME}.blob.core.windows.net/static/"
 {%- endif %}
+{%- endif %}
 
 # EMAIL
 # ------------------------------------------------------------------------------


Test patch: