cookiecutter / cookiecutter-django

Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.
https://cookiecutter-django.readthedocs.io
BSD 3-Clause "New" or "Revised" License
12.15k stars 2.91k forks source link

Merge use_whitenoise and cloud_provider #2085

Closed vCra closed 5 years ago

vCra commented 5 years ago

Description

Currently, users are prompted to use whitenoise and to select a cloud provider for static/media files. We should consider combining the whitenoise option into the cloud provider section.

Rationale

If a user is using external object storage (s3/gcs), then they is no need (AFAIK) to have whitenoise - all files are served externally. In addition, merging the options will give the user context as to what whitenoise is for. Whist on the subject, we might clarify what services from each provider will be used (i.e. specify s3 etc.)

Use case(s) / visualization(s)

The end result could look something like follows

    Select file_storage_provider:
    1 - AWS (S3)
    2 - GCP (GCS)
    3 - Whitenoise (Self contained)
    4 - None
    Choose from 1, 2, 3, 4 [1]: 1

Use cases

  1. The user is hosting on AWS/GCP - They select 1/2, and don't get prompted about whitenoise, because they won't need it.
  2. The user is hosting on Heroku/Openshift - They select 1, 2 or 3 - they have the option of using 2 cloud providers, but whitenoise is presented at the same time
  3. The user is hosting on PythonAnywhere (where static file storage is provided) - They select 4
browniebroke commented 5 years ago

One problem, Whitenoise does not cover media files: http://whitenoise.evans.io/en/stable/django.html#serving-media-files

vCra commented 5 years ago

It doesn't - if a user needs to handle media files, then they will need choose to use AWS/GCP, as is the case currently. That option will still be available, but just with the option of using whitenoise removed.

browniebroke commented 5 years ago

Ah I think I see your point, but AFAIU, it's missing one use case (that I quite like): Whitenoise for static AND AWS/GCP for media.

In this case, cookiecutter-django should still use django-storages. If it's not, then there is a bug.

That's why I think they are not necessarily mutually exclusive. With what you suggest, if I choose Whitenoise, it's unclear how & where I would host my media files...

Am I missing something?

vCra commented 5 years ago

Ahhh - I didn't think of the usecase of whitenoise AND AWS/GCP - I would have presumed if people are using AWS/GCP, then they would use it for everything, including static files. Just using whitenoise would be for projects that do not require media files I'll close this for now