question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Selecting whitenoise still requires AWS setup

See original GitHub issue

I had selected whitenoise from the django cookiecutter configuration, but when it comes to deploying on heroku I get an improperly configured error if eg DJANGO_AWS_ACCESS_KEY_ID isn’t set (same with the other AWS envs). The settings file also outputs the comment at the top: `Use Amazon’s S3 for storing static files and uploaded media’ even though the whitenoise middleware looks to be properly setup.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
jayfkcommented, Nov 21, 2016

Whitenoise is working pretty well in the current configuration on multiple platforms. If we are going to remove it, we have to find another library that supports all of them, too.

From my POV, this is a documentation problem:

  • whitenoise is used for static files
  • django-storages with AWS is used for media files

That makes total sense, because static and media files both have different requirements. Static files can be generated from scratch for each deployment, media files OTOH are ideally stored in a central place with proper backups (S3).

For certain deployments, it might make sense to add an option to let whitenoise also handle the media files.

3reactions
yunticommented, Nov 28, 2016

@pydanny. Thanks for the input. I think the assumption here is that all sites need to serve media files, where for a lot, they don’t so a simplified Whitenoise (plus CDN) does have value.

The original question was assuming no media files were required and was never about whitenoise being used to serve media files (that really doesn’t seem to be it’s intended use case) . sorry if this wasn’t clear.

The default setup when choosing whitenoise almost works with this, it just needs a WHITENOISE_MAX_AGE to be set to work with with a CDN. (All the AWS settings are then redundant if not using S3 for static files).

So perhaps cookiecutter should have a ‘use_whitenoise’ y/n and a ‘use_aws_for_media’ y/n question where if whitenoise is selected all awss option to do with static file serving are dropped eg AWS_EXPIRY and if ‘use_aws_for_media’ is n then the rest of the settings are dropped.

I don’t mind if you wish to get the cookiecutter config options down to have this in the docs.

Happy to make the changes needed as so far with django-cookiecutter I’ve done,

  • Whitenoise, static only
  • Whitenoise + CDN (static)
  • Whitenoise + CDN (static) + AWS (media)

(Probably should have ditched whitenoise in the last case, but it evolved to that overtime. )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selecting whitenoise still requires AWS setup #869 - GitHub
It seems like a halfway house of whitenoise and AWS set up by default, and I'm now trying to get away from AWS...
Read more >
Using WhiteNoise with Django
Restricting CloudFront to static files# · Go to your newly created distribution and click “Distribution Settings”, then the “Behaviors” tab, then “Create ...
Read more >
'collectstatic' command fails when WhiteNoise is enabled
The problem here is that css/iconic/open-iconic-bootstrap.css is referencing a file, open-iconic.eot , which doesn't exist in the expected location.
Read more >
Serving Static Files from Flask with WhiteNoise and Amazon ...
To set up, log in to the AWS Console and navigate to the CloudFront dashboard. Click "Create Distribution" and choose "Get Started" under...
Read more >
Static Files Made Easy — Django Compressor + Whitenoise + ...
Tutorials galore on how to set up Django with AWS S3 or Whitenoise, but rarely can one find detailed guides on configuring Whitenoise, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found