Django - Serving MEDIA/uploaded files in production

Django is built to be an "application server", not a "web server".

In other words, serving static files from Django will have worse performance than using Apache or Nginx. These static content servers are (1) written in C and (2) optimized for performance.

In contrast, Django is (1) written in pure Python and (2) optimized for developing an application.

See the documentation.


That may be totally fine. I have used Django to serve static content in production, when I knew the load would not be high and I wasn't serving large files. It depends on what kind of environment "production" actually is.


FYI, A common production setup would be to use Nignx, Django, Gunicorn, and Supervisor. Nginx servers the static content from disk and reverse proxies the rest of it to Gunicorn, which runs multiple Django instances. Supervisor monitors Gunicorn and makes sure it stays running. It all depends on what level of web application you need.


It is not recommended to serve static files from the django server itself. The recommended way is to serve them in a separate server. check static files deployment, there you will find all you need.