[mod_python] Advantages of running non web oriented script using mod_python

Clodoaldo Pinto Neto clodoaldo.pinto.neto at gmail.com
Thu Oct 16 19:10:40 EDT 2008


2008/10/16 Leeron Shalev <leeron at devunity.com>:
> I'm currently working on something else, and just pondering the
> python-to-php issue, so yes, please do get back to me later with the rest of
> the details.

This is the php code:

$server_name = $_SERVER['SERVER_NAME'];

$url = "http://$server_name/python/mp_history.py?d=$team&t=team_update%3bteam_daily";

$big = eval_array(file_get_contents($url));

And this is the mod_python config:

    <Directory /var/www/html/example.com/python>
       SetHandler mod_python
       PythonHandler mod_python.publisher
    </Directory>

If you don't have anything running on mod_python don't use it. In
instead use mod_wsgi. I used mod_python in the site above about two
years ago. I would not do it today.

Regards, Clodoaldo

> The thing is, I'm sure it will work - I'm just asking if anybody has a word
> of wisdom on which of the approaches will work best.
>
> On Thu, Oct 16, 2008 at 5:05 PM, Clodoaldo Pinto Neto
> <clodoaldo.pinto.neto at gmail.com> wrote:
>>
>> 2008/10/16 Leeron Shalev <leeron at devunity.com>:
>> > Hello list :)
>> > I love python, and have some experience using mod_python.
>> > The thing is I have a web site that is based heavily upon PHP.
>> > I have a specific task (Involving file manipulation and some libraries
>> > that
>> > are implemented better in python than in PHP) that I'm planing on using
>> > a
>> > python script for.
>> > At start I thought I'll use mod_python for it, but the integration with
>> > the
>> > DB and PHP objects soon became to much of a pain in the ass.
>> > So the the two main options I'm now considering are:
>> > 1. Using PHP for everything else and calling the python script using
>> > PHP's
>> > exec() function.
>> > 2. Using PHP for everything else and calling the python script via
>> > apache
>> > and mod_python. (using php fopen() or something).
>> > As I said, the final python script is mainly for manipulating the
>> > filesystem
>> > and not really a web oriented script -
>> > Do you think I'll have any benefits from using method 2 (in terms of
>> > performance and concurrency) ?
>> > Any help, thoughts or advice will be much appreciated.
>>
>> I have an old php site in which the chunck of code that executes a
>> certain task was a bit convoluted (as usual in php) and as i wanted to
>> change it i wrote it in python and it works nice. It is called as a
>> web service and returns some lists (as text not html) which are loaded
>> into arrays in php. I don't remember how exactily i did it as i have
>> no access to the server now. In some hours i can check it and return
>> to you if you still haven't figured it out.
>>
>> Regards, Clodoaldo
>>
>> > Cheers,
>> > Leeron
>> > _______________________________________________
>> > Mod_python mailing list
>> > Mod_python at modpython.org
>> > http://mailman.modpython.org/mailman/listinfo/mod_python
>> >
>> >
>
>


More information about the Mod_python mailing list