Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should CSS and JS not go through Django?

As per this answer to Can I gzip JavaScript and CSS files in Django?:

Your CSS and JS should not be going through Django on your production system. You need to configure Apache (or Nginx, or whatever) to serve these, and when you do so you'll be able to set up gzip compression there, rather than in Django.

The answers to that question don't explain the reason for this requirement/advice. Is it just a good practice for speed to have static content (images/CSS/JS) served from a different server? Or is there more to it?

like image 825
super9 Avatar asked May 26 '11 08:05

super9


1 Answers

Apache and Nginx are faster than Django (because they do much less and much simpler things). So serving CSS and JS with Django is a waste of resources.

Although "should" is too strong here, IMO. "Should, if you have high traffic", rather.

like image 144
Lennart Regebro Avatar answered Sep 28 '22 00:09

Lennart Regebro