python – Why do I need Apache or nginx under Django?

Question: Question:

When he does web development with Django, most of the information is configured to run his Django on the so-called web servers Apache and nginx.
However, Django is a web server in its own right, and I don't know why to use Apache or nginx.
Some say that Django is an "application server", so you need a "web server" underneath it, but if the Django process is running, you don't need it. think.
If you follow the Django tutorial, you can directly HTTP communication without running a separate web server service.

These may not be limited to Django, but I'm confused because I'm a beginner and I don't know the background.
Why do you need Apache / nginx? Shouldn't I just host my web service with Django?

Answer: Answer:

Not limited to Django, in general, the application server is not published directly, but is published via a web server such as Apache or nginx.

The main reason for this is that the CPU and memory efficiency of the application server is poor, so static files such as images, style sheets, and script files are left to the high-speed web server.

In addition, I want to have the processing around the infrastructure such as access control on the Web server instead of the application side, and I want to use the high-performance mechanism of the Web server that can flexibly handle multiple application servers (application). Servers are often less functional as web servers).

Scroll to Top