On May 30, 11:24 am, digimotif <[EMAIL PROTECTED]> wrote:
> On May 24, 5:01 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On May 25, 5:24 am, aspineux <[EMAIL PROTECTED]> wrote:
>
> > > On 24 mai, 19:33, Szabolcs Nagy <[EMAIL PROTECTED]> wrote:
>
> > > > > Is there a way I could code the base (core) code in Python and have
> > > > > PHP call it?  I've really liked using SQLAlchemy and there are other
>
> > > > * quick and dirty solution:
> > > > in a shell:
> > > >   $ python yourscript.py <pipe_in >pipe_out
> > > > in the php script:
> > > >   fwrite(pipe_in, input_data);
> > > >   results = fread(pipe_out, sizeof_results);
>
> > > > * simple and nice solution:
> > > >   do not ever use php
>
> > > Write a CGI wrapper around your python script, and publish it 
> > > usingmod_python.
> > > And make the appropriate http requests from PHP.
>
> > You do not needmod_pythonto host CGI scripts written in Python, they
> > are two separate things.
>
> > Depending on the complexity of what you are doing, you might be better
> > off writing a backend server in Python that incorporates an XML-RPC
> > server. Your PHP script can then use XML-RPC client to communicate to
> > the backend Python server to do the real work. Over time you could
> > even transition your web pages to being done in Python instead. In
> > doing this your back end Python server doesn't have to change, you
> > just make XML-RPC calls from the Python code for the web pages in
> > place of where you would be doing it with PHP initially. You also
> > wouldn't be restricted to web based front ends, you could also use GUI
> > based front end as well.
>
> > Graham
>
> This sounds more like the direction I should go.  Is XML-RPC the only
> technology allowing this sort of setup?  If I understand correctly, it
> would basically mean going to a three tiered application approach.
> I'd have the database, the python xml-rpc server, and the gui/web
> interfaces.  I'd also want to make sure I'm implementing technology
> that will scale well.

There is also Pyro, but by using that you limit yourself to Python
clients as far as I know whereas XML-RPC has clients for lots of
different languages. Other more complicated options are Corba and SOAP
frameworks.

Graham


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to