

How to serve Django Statics (and not go insane) - dualogy
http://blog.sendhub.com/post/36219926831/how-to-serve-django-statics-and-not-go-insane

======
spmurrayzzz
There's something I'm not clear about with respect to the stated problem. I
have wrestled with the Django static dance myself, but the most obvious
solution (to me at least) was to add a `location` section to my nginx config
pointing to my static assets path.

I get all the same benefits named in the article; such as gzip, though I have
to build my scripts locally ahead of time (which is trivial via Grunt).

But served this way, that route never touches the framework itself. At a
glance, it seems that letting nginx deal with those assets would be much
faster in terms of response time rather than the alternative of routing
through Django.

Am I missing something obvious here?

~~~
herge
If you serve your static resources through S3, you can share the same static
resources among multiple app servers. Also, a proper CDN will serve them a lot
faster than your app server through nginx can.

~~~
antihero
CDNs aren't _necessarily_ faster because you have to have a connection to a
different server. _However_ the idea is that say you have jQuery loaded for a
CDN, and so do a bunch of other sites (so, same URL), they will already have
the thing cached when they load up your site.

------
icebraining
Have you measured the change from standalone to embedded images in the CSS? Is
it really worth the increase in size (due to base64) and the lack of
parallelization?

~~~
mctx
Also caching. In terms of parallelisation, this method is only beneficial if
there is currently request queuing, same principle as using sprites -
[https://developers.google.com/speed/docs/best-
practices/rtt#...](https://developers.google.com/speed/docs/best-
practices/rtt#SpriteImages)

------
wheaties
How do I get to your website from your blog? I'm viewing it on my phone and
there's no obvious link.

~~~
zorlem
There is a "visit us @ SendHub" in the header of the page, just bellow
"SendHub Blog" and their logo. I can see it Chromium in Linux though, haven't
tried it in a mobile browser.

