Creating a WSGI application

All the requests that we make to our server will be handled by the WSGI application, which will be a single file. This application will be responsible for handling the requests and returning the appropriate response according to the requested URL. In this application, we will have to define a function that acts with each user's request. This function must be a valid application WSGI function. This means that it should be called application and it should receive two parameters: environ, from the os module, which provides a dictionary of standard HTTP requests and other environment variables, and the start_response function, from WSGI, which is responsible for delivering the HTTP response to the user.

In the following ...

Get Learning Python Networking - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.