[TriZPUG] Who is using Apache httpd in front of Python webapps?

Joseph S. Tate dragonstrider at gmail.com
Thu Apr 17 01:47:37 CEST 2014


I used to use mod_python, but now use mod_proxy (usually as mod_rewrite
"RewriteRule ^(.*) http://127.0.0.1:5000/$0 [P]" so that I have more
flexibility for creating custom URLs to be handled by other apps. WSGI can
be used for this, but Apache is faster.

But, that's only for a site that I put up 5 years ago and still maintain.
New sites I put behind nginx. Deployment is simpler, options are more
plentiful, memory footprint is much lighter, and it's faster to boot.


On Wed, Apr 16, 2014 at 3:25 PM, Jeff Trawick <trawick at gmail.com> wrote:

> On Wed, Apr 16, 2014 at 2:32 PM, David Burton <ncdave4life at gmail.com>wrote:
>
>> I have Apache on my little Scientific Linux server in my home, and about
>> a year ago I installed mod_python to support Python Server Pages (.psp).
>>
>
> Wow, I didn't expect to hear about mod_python!  (I didn't realize that it
> had been resurrected.)
>
>
>>
>> It works, using Python 2.7, with some issues. Here's a working PSP page:
>> http://sealevel.info/data.psp
>>
>> it is equivalent to this PHP page:
>> http://sealevel.info/data.php
>>
>>
>> I ran into a few bumps in the road, and made a few notes. These notes are
>> from almost a year ago, so they are out-of-date. But here they are:
>>
>>
>> *1.*  p.5 of http://www.modpython.org/live/current/modpython.pdf said:
>>
>> "2.1 Prerequisites
>> • Python 2.3.4 or later. Python versions less than 2.3 will not work."
>>
>> But that wasn't accurate, because Python 3 didn't work, either, as of a
>> year ago.
>>
>> *However, I see that the documentation has been updated, and it now says
>> that Python 3 works!*
>>
>>
>> *2.*  *It needed a patch.*  It wouldn't build at all without the patch.
>>
>>   ./configure --with-apxs=/usr/sbin/apxs
>> --with-python=/usr/local/bin/python2
>>
>>     connobject.c:142: error: request for member 'next' in something not a
>> structure or union
>>     apxs:Error: Command failed with rc=65536
>>
>> Googled it.  Found the error here:
>> https://bugzilla.redhat.com/show_bug.cgi?id=467637
>> which redirected to here:
>> https://bugzilla.redhat.com/show_bug.cgi?id=465246
>> which had a 4.5 year-old patch:
>>
>> diff -rNu mod_python-3.3.1/src/connobject.c
>> mod_python-3.3.1-atomix/src/connobject.c
>> --- mod_python-3.3.1/src/connobject.c 2006-12-03 05:36:37.000000000 +0100
>> +++ mod_python-3.3.1-atomix/src/connobject.c 2008-10-02
>> 14:10:02.000000000 +0200
>> @@ -139,7 +139,7 @@
>>      bytes_read = 0;
>>
>>      while ((bytes_read < len || len == 0) &&
>> -           !(b == APR_BRIGADE_SENTINEL(b) ||
>> +           !(b == APR_BRIGADE_SENTINEL(bb) ||
>>               APR_BUCKET_IS_EOS(b) || APR_BUCKET_IS_FLUSH(b))) {
>>
>>          const char *data;
>>
>> After I applied the patch to connobject.c, mod_python built successfully
>> (though it still had a lot of warnings).
>>
>> Hopefully the patch is no longer needed in the current version.
>>
>>
>> *3.*  There seemed to be no way to use "from __future__ import ..." --
>> in part because it generated
>> a (useless) zero-length req.write("""""",0); at the beginning.  The
>> "from __future__ import..."
>> must be the first line of Python code.  However, I implemented a hack to
>> avoid the zero-length req.write, and "from __future__ import" still didn't
>> work, so there was obviously some other issue, too.
>>
>> I don't know whether this is still a problem in the current version, or
>> not.
>>
>>
>> *4. *Calling either  str(type(req.finfo))  or  repr(type(req.finfo))
>>  caused the Python program to silently abort. I didn't bother to try to
>> figure out why, and I don't know whether this is still a problem in the
>> current version, or not.
>>
>
> apr_file_info_t :)
>
>
>>
>>
>> Dave
>>
>>
>>
>> On Wed, Apr 16, 2014 at 1:37 PM, Chris Calloway <cbc at unc.edu> wrote:
>>
>>> On 4/16/2014 12:07 PM, Jeff Trawick wrote:
>>>
>>>> If so, what httpd module(s) are you using to route/proxy requests to the
>>>> webapps?  I'm familiar with the mechanisms; this is an informal survey.
>>>>
>>>> I am thinking about what httpd+application space to cover at ApacheCon
>>>> EU in November, having given FastCGI-specific and
>>>> survey-of-httpd+Python/Perl/PHP/Ruby talks in the past
>>>> (http://emptyhammock.com/projects/info/slides.html).  Maybe
>>>> httpd+Python
>>>> is interesting enough to concentrate on Python for a change, as well as
>>>> practice the talk before I get to Budapest ;)
>>>>
>>>
>>> Hi Jeff,
>>>
>>> A bunch of us on campus, not just me, used to front Plone with Apache
>>> and used mod_rewrite and Zope's Virtual Host Monster for reverse proxy.
>>> This also usually involved occasional route mangling with rewrite rules.
>>> We've all switched to Nginx now.
>>>
>>> You'll love Budapest.
>>>
>>> --
>>> Sincerely,
>>>
>>> Chris Calloway http://nccoos.org/Members/cbc
>>> office: 3313 Venable Hall   phone: (919) 599-3530
>>> mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599
>>
>>
>> _______________________________________________
>> TriZPUG mailing list
>> TriZPUG at python.org
>> https://mail.python.org/mailman/listinfo/trizpug
>> http://trizpug.org is the Triangle Zope and Python Users Group
>>
>
>
>
> --
> Born in Roswell... married an alien...
> http://emptyhammock.com/
> http://edjective.org/
>
>
> _______________________________________________
> TriZPUG mailing list
> TriZPUG at python.org
> https://mail.python.org/mailman/listinfo/trizpug
> http://trizpug.org is the Triangle Zope and Python Users Group
>



-- 
Joseph Tate
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/trizpug/attachments/20140416/6330174e/attachment-0001.html>


More information about the TriZPUG mailing list