Using the CGI process is a quick and simple way to get your Python code on the web. For the purposes of this illustration, we'll use Apache as an example. Please bear in mind that 40% of internet web servers are now running Nginx; however, due to space considerations, we will only present the Apache configuration here.
First, you need to install the Apache mod_wsgi module. Although this can be done through the normal package management for your operating system, it's recommended to install it using pip3. If you see a warning about missing operating system dependencies, make sure these are installed first before proceeding with this command:
pip3 install mod-wsgi
IMPORTANT: If you are using a Docker container, as outlined at the beginning of this chapter, this command is not needed as mod-wsgi is already installed in the provided Docker container. However, if you are setting up a Python web application on a customer server that is not using...