Python – Apache2.4 + Python 3.7 + mod_wsgi not executing script

apache-2.4mod-wsgipython

I have installed Apache 2.4 (vc15 apacheLounge) and Python 3.7. I installed the mod_wsgi using PIP and everything appears to be setup correct in the Apache server.

error.log from apache:

[mpm_winnt:notice] [pid 9688:tid 780] AH00455: 
Apache/2.4.37 (Win64) mod_wsgi/4.6.5 Python/3.7 configured -- resuming normal operations
[mpm_winnt:notice] [pid 9688:tid 780] AH00456: Apache Lounge VC15 Server built: Nov 21 2018 11:51:35

I followed the steps on "https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html" and when I try to load the test app all I get is a text view of the code.

My httpd.conf files details:

WSGIScriptAlias /wsgi "C:/apache24/htdocs/wsgi_app/wsgi_app.wsgi"

<Directory /apache24/htdocs/wsgi_app>
<IfVersion < 2.4>
    Order allow,deny
    Allow from all
</IfVersion>
<IfVersion >= 2.4>
    Require all granted
</IfVersion>
</Directory>

Best Answer

The path of WSGIScript alias should be pointed at the application URL:

Most generally it is:

WSGIScriptAlias / "C:/apache24/htdocs/wsgi_app/wsgi_app.wsgi"

Also make sure, PythonPath is a env variable or stated in the conf file.