Re: Python 3 and mod_wsgi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 14, 2014 at 04:54:33PM -0400, Bohuslav Kabrda wrote:
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> 
>     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?
> 

It's available in rawhide already and uses the conflicts that you outline:
http://koji.fedoraproject.org/koji/buildinfo?buildID=493296
https://bugzilla.redhat.com/show_bug.cgi?id=1007002

However, conflicts aren't the correct strategy here.

Instead, take a look at how the python26-mod_wsgi package is implemented for
epel5.  The two mod_wsgi packages should be parallel installable.  But the
apache config files should prevent both from being loaded into a single
apache process.  Here's the config file for the python26-mod_wsgi package
as a example of this:

  # NOTE: By default python26-mod_python with not load if mod_wsgi is
  # installed and enabled.  Only load if mod_python and mod_wsgi are not
  # already loaded.

  <IfModule !wsgi_module>
    LoadModule wsgi_module modules/python26-mod_wsgi.so
  </IfModule>

We should probably have a similar guard in the mod_wsgi config file as well.
Then be sure that we consciously name the conf files so that we are
promoting one of these as the default (because sort order will load one of
them before the other) if both packages are installed.

Having both packages be parallel installable makes it easier for people
who are willing to configure apache to start two separate instances of
apache.  The two instances could each run a different version of mod_wsgi by
adding the correct mod_wsgi config for each.

Bug filed:
https://bugzilla.redhat.com/show_bug.cgi?id=1087943

-Toshio

Attachment: pgpnY1Cr9GTzO.pgp
Description: PGP signature

-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux