Search code examples
pythonmod-wsgimod-pythonmod-fastcgi

deploying a WSGI application on mod_python


I wrote a WSGI application which I need to deploy to a server, however I've been given a server that already has mod_python installed.

I am not allowed to remove mod_python since there are some mod_python applications running on it already.

One option I considered was installing mod_wsgi alongside mod_python, however I went through sources and found that was a bad idea. Apparently mod_wsgi and mod_python don't mix well.

Another option I considered was installing mod_fastcgi and deploying it using fastcgi.

I would love to hear if someone has a better idea which doesn't break the current mod_python applications running on the server.


Solution

  • You can use mod_python and mod_wsgi together so long as same Python version and mod_python not linked against a static Python library.

    Run the 'ldd' command on the mod_python.so file:

    ldd mod_python.so
    

    to find out if it links to libpythonX.Y.so. Build mod_wsgi to use same Python version, ensuring it is similarly linked against same libpythonX.Y.so.


    UPDATE

    Version 4.X of mod_wsgi now explicitly refuses to start if mod_python is also loaded. In order for mod_python and mod_wsgi to be used together, certain features of mod_wsgi had to be crippled. As mod_python is now very old, not meaningfully updated, has various problems with it and should not be used for anything new, no longer trying to support them being used together.