Ruben Ruben - 1 month ago 13
Apache Configuration Question

Tryng to run 2 Python applications with different Python versions with mod_wsgi

I have in my Apache 2 applications: Django app and MoinMoin app. The first one is running now with Python3.4 and the second one (MoinMoin) with Python2.7

When running dpkg:

ruben@babylon:/var/log/apache2$ dpkg -l | grep wsgi
rc libapache2-mod-wsgi 3.4-4ubuntu2.1.14.04.2 amd64 Python WSGI adapter module for Apache
ii libapache2-mod-wsgi-py3 3.4-4ubuntu2.1.14.04.2 amd64 Python 3 WSGI adapter module for Apache


but Apache can't run the 2 modules at the same time. Django (Python3) is working but MoinMoin (Python2.7) not. How can I fix that?

Thanks.

Answer

As you were told already in:

you cannot do that within a single Apache instance.

The simple answer as was described is to run a separate WSGI server such as mod_wsgi-express, or you can use gunicorn our something else as well, and set it up behind the main Apache instance it with Apache proxying to it.

There are a lot of details around doing this and as also suggested, you are better off asking on the mod_wsgi mailing list if you want to do this with mod_wsgi.

If don't wish to use the mod_wsgi mailing list, then you can find some information in:

It talks about proxying to backend WSGI application running in Docker, but all the same principles apply as to setting up the proxy fronted and the issues that arise.