Hi, in this post I want to write about a problem that I have encountered when I configured apache with the wsgi mod to run python/wsgi scripts from apache.
The specific error is as follow:
We can think that it is a problem of the code, but executing the script manually, this error is not generated. This gives us a clue that the problem is in apache and not in the script.
The project is organized as follows:
The python wsgi script is:
The first step to fix the error is to correctly configure the apache virtual host file to correctly find our project when we make the request to the server.
The web.com.conf file in the sites-available folder must contain the following configuration:
The second and final step is to add the following lines to the wsgi script:
The script will look like this:
Remember, restart the apache server and check that the problem is solved.
References: