Serving static files

47 views
Skip to first unread message

Ankush Thakur

unread,
Jun 27, 2016, 12:27:34 PM6/27/16
to django...@googlegroups.com
I keep hearing in the docs and in tutorials that frameworks are horrible when it comes to service static files. In production, also, one needs to set up another dedicated server to serve static files.

I'm wondering why. What is so special about serving static files that a framework comes to a halt, even though the same framework can happily serve thousands of requests per hour?

Regards,
Ankush Thakur

ludovic coues

unread,
Jun 27, 2016, 12:37:43 PM6/27/16
to django...@googlegroups.com
It's not that the framework will come to an halt. It's that a server
serving static file directly would be an order of magnitude faster.

https://unix4lyfe.org/time/hn.html is a nice article on how server
react to heavy load when serving static file.
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALX%3DrKLw_nMxZz7xeC0N%3D5Zwn0Q0eZnV_GFGkdwmP-%3DabtPMUQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42

Ankush Thakur

unread,
Jun 28, 2016, 9:59:26 PM6/28/16
to Django users
Thanks but I'm afraid I wasn't able to grasp the point of that article. Could you break it down for me, please? 

~~Ankush

Tim Graham

unread,
Jun 28, 2016, 10:03:07 PM6/28/16
to Django users
The concerns about needing a separate server are likely overblown. In particular, Whitenoise is a popular solution for static file serving using Python. See its FAQ: http://whitenoise.evans.io/en/stable/#isn-t-serving-static-files-from-python-horribly-inefficient

Ankush Thakur

unread,
Jun 28, 2016, 11:00:45 PM6/28/16
to django...@googlegroups.com
Hmmm. One argument I read supporting separate servers is that it would save the main server a few socket connections. But this appears to be too little of a gain. The approach of using a CDN, I think, is much more sensible. 

Thanks once again, Tim!


Regards,
Ankush Thakur

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/U1Y52ad4lDM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages