I noticed that most of the books and tutorials on Django make it very clear that use Django development server as a normal webserver is not OK. But some state that other webservers are optional, that we can use Django server to put the website on the web for everybody to see.
But why exactly? Why do I need (or not) to use Apache, Lighttpd, Nginx, etc. in front of Django - WSGI?
Is Django server not safe in some way? If so, how it is unsafe exactly, and why can't Django just come with a more robust webserver (out of the box, ready to use)?
How exactly those webservers help Django? *I know that those webservers have very useful mods, but AGAIN: couldn't Django just come with a safer "mod-able" webserver?
My understanding is that the folks at Django are not specialized in the server business and they never intended their server code to produce anything other than a way to develop and test on one's local machine without a lot of traffic. Per their own documentation
Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing. (We’re in the business of making Web frameworks, not Web servers.)
It comes down to the goal of the Django project and the efficiency gains associated with re-use (as opposed to reinventing the wheel).
The stated goal for Django is to offer a web application framework that enables quick development and minimal code. The original tagline was a "web application framework for perfectionists with deadlines".
That goal can be accomplished with a simple single-threaded web server that simply facilitates development and testing.
The goal of Apache httpd, Nginx, IIS, etc. on the other hand is to offer exceptionally scalable and performant web servers. These applications are highly configurable as all applications differ and there's no one size fits all. They also require different expertise to design, implement and maintain.
So it makes a lot of sense that with limited resources (developer time), the Django team chose to focus on the web-app framework, and leave the production-ready web server to another project.
It is not something specific to Django, that is the case for all modern web frameworks that I know, they all have this very simple built-in web server that we use only for development purposes, and the reason is obvious, it does not make any sense to reinvent the wheel since we already have very powerful web servers.
Another important thing is that you can use one web server for one or more web applications that might be developed using different programming languages and web frameworks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With