Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback on 3.0b1 #75

Closed
evansd opened this issue Mar 12, 2016 · 9 comments
Closed

Feedback on 3.0b1 #75

evansd opened this issue Mar 12, 2016 · 9 comments

Comments

@evansd
Copy link
Owner

evansd commented Mar 12, 2016

@edmorley I've just pushed a beta of WhiteNoise 3.0. Changes and documentation are here:
http://whitenoise.evans.io/en/latest/changelog.html

If you have time, I'd love feedback from you or anyone else at Mozilla who's using WhiteNoise before I unleash it on the general public.

Thanks!

@edmorley
Copy link
Contributor

These changes are awesome :-)

Things tested locally:

  • using the new whitenoise.runserver_nostatic
  • using via both gunicorn and runserver
  • using with DEBUG True/False
  • gzip serving of both Django static files and those added via WHITENOISE_ROOT

Not tested:

  • brotli support (libffi not available on some of our infra for now, so deferring)
  • replacing our use of wsgi-sslify wrapping the WSGI app with the Django security middleware (though I can't see why this wouldn't work as documented, so somewhat irrelevant)

The only thing I spotted was that the changelog doesn't mention the STATICFILES_STORAGE backend rename of whitenoise.django.GzipManifestStaticFilesStorage to whitenoise.storage.CompressedManifestStaticFilesStorage (whilst the old one still works, I'm guessing it will be deprecated in the future).

The branch for our changes is here (I'll probably hold off until final release before deploying, if only because I have a few other things that need finishing up before the end of the quarter):
https://github.com/mozilla/treeherder/compare/whitenoise-3.0

Many thanks!

@evansd
Copy link
Owner Author

evansd commented Mar 15, 2016

Thanks @edmorley, that's really helpful.

I didn't realise you were using the python -m whitenoise.gzip utility. From my brief searching it didn't look like it was getting much use so I didn't think it was worth maintaining the old command as an alias. It would be easy enough to do though if you think it would be helpful.

The old storage backend name has found its way into quite a few "how to get started with Django" tutorials online, and I'd really rather not break all of those so I think I'll maintain the old alias for a while in any case. But you're right, I should note the change in the docs.

@edmorley
Copy link
Contributor

Switching to python -m whitenoise.compress is no trouble - I don't think an alias is necessary unless lots of other people are using it, and this GitHub code search says there aren't many public repos doing so at least :-)

@edmorley
Copy link
Contributor

I've just tested the compress util with the Brotli package installed this time - worked well (I've not tested serving the resultant .br files, since it's only supported over HTTPS, and I ran out of time to sort out something self-signed locally).

The official Brotli repo now does have a Python wrapper - albeit there's no package on PyPI yet, so it needs installing from GitHub (eg pip install https://github.com/google/brotli/archive/v0.3.0.zip). Whilst it does require g++ to be installed, unlike brotlipy it is (a) official, and (b) doesn't have a dependency on libffi. Hopefully the official PyPI package will be released soon (google/brotli#72).

@evansd
Copy link
Owner Author

evansd commented Mar 21, 2016

Thanks, good to know about the official brotli package. It looks like the very minimal API I'm using is 100% compatible between brotlipy and the official version so it shouldn't need any code changes -- just need to delete two characters from the docs and recommend brotli over brotlipy!

The absolute quickest way to test HTTPS locally is the insanely useful ngrok which gives you a globally accessible, HTTPS-secured tunnel back to your local machine. So you run:

ngrok http 8000

and then you can access your dev server via a URL like https://1382c1fd.ngrok.io

Sadly I've discovered that CloudFront strips everything except gzip from the Accept-Encoding header so the brotli support doesn't help if you're behind CloudFront. I'm assuming Amazon will fix this in time as it gets more popular, and hopefully other CDNs are more compliant (though I haven't been able to test them yet).

@edmorley
Copy link
Contributor

The absolute quickest way to test HTTPS locally is the insanely useful ngrok

Ah I hadn't heard of ngrok before - that's helpful, thank you :-)

I've now opened a PR to switch to 3.0rc1 for one of our projects (mozilla/treeherder#1362) - I've decided not to wait for the final release.

@evansd
Copy link
Owner Author

evansd commented Mar 23, 2016

Just pushed the final release. Thanks for all your help with this.

@evansd evansd closed this as completed Mar 23, 2016
@edmorley
Copy link
Contributor

Working well now we've deployed mozilla/treeherder#1362 - thank you for all your changes in WhiteNoise 3.0 :-)

$ curl -I https://treeherder.allizom.org/static/embed/css/embed.css -H 'Accept-Encoding: br '
HTTP/1.1 200 OK
Date: Wed, 30 Mar 2016 13:07:38 GMT
Server: gunicorn/19.4.5
X-Backend-Server: treeherder1.stage.webapp.scl3.mozilla.com
Content-Length: 92
Content-Encoding: br
strict-transport-security: max-age=31536000
Vary: Accept-Encoding
Last-Modified: Wed, 26 Aug 2015 22:02:49 GMT
Cache-Control: public, max-age=60
Access-Control-Allow-Origin: *
Content-Type: text/css; charset="utf-8"

@evansd
Copy link
Owner Author

evansd commented Mar 30, 2016

Great to hear that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants