Python 3 and mod_wsgi

Bohuslav Kabrda bkabrda at
Mon Apr 14 20:54:33 UTC 2014

----- Original Message -----

> I naively ported my Django app to Python 3 and didn't realize WSGI was going
> to be an issue. I saw python3-django was available for Fedora 20 and thought
> I was all set until I saw in my httpd logs that python2.7 seems to be the
> assumed default for mod_wsgi. After reading the README and more, I see the
> writing on the wall:

> """
> If you have multiple versions of Python installed and you are not using
> that which is the default, you may have to organise that the PATH inherited
> by the Apache application when run will result in Apache finding the
> alternate version. Alternatively, the WSGIPythonHome directive should
> be used to specify the exact location of the Python installation
> corresponding to the version of Python compiled against. If this is not
> done, the version of Python running within Apache may attempt to use the
> Python modules from the wrong version of Python.
> """

> I take this to mean that merely fiddling with WSGIPythonHome alone will be
> insufficient and that I would need to recompile the package. Is that
> correct, or did I miss a Python3-specific mod_wsgi package or some other
> neater solution? If I am truly forced to recompile -- as reversing the
> Python 3 is really undesirable at this point -- is there any reason Fedora
> couldn't have two mod_wsgi packages (one for Python2 and another for
> Python3)?

AFAIK you can't have 2 mod_wsgi's, each one compiled against a different Python major.minor, loaded by Apache at the same time for various reasons. So the best solution would IMO be to create python3-mod_wsgi (subpackage of mod_wsgi), that would conflict with mod_wsgi. It should be perfectly doable and it shouldn't break anything. 
CCing Matthias, the owner of mod_wsgi in Fedora - Matthias, what do you think? 


> --
> John Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list