24April14
24April14

Reputation: 177

how Django reads http request and sends http response

If I write a simple http server in C. I can read http request through a file descriptor generated by accept() function in a while loop. And I can send http response to client through that file descriptor.

In Django I know the HttpRequest object will be passed to view function as a argument, but I want to know which function reads the HttpRequest through the socket and generate a HttpRequest object?

I know view function will return a HttpResponse object. But which function will send the actual http response to the client?

And where is the while loop?

Upvotes: 1

Views: 229

Answers (1)

Igonato
Igonato

Reputation: 10787

Django doesn't do this. It implements WSGI standard and sits behind a WSGI server (such as Gunicorn or uWSGI) and lets it interact with sockets. If you want to learn more about it, you need to look up what's going on inside a wsgi server.

Upvotes: 1

Related Questions