Ben Finney wrote: > Howdy all, > > I'm working on a web application that is starting to gain a lot of > back-end code written in Python. However, all the current interface > code is written in legacy PHP. I'd like to slowly introduce new > features as Python WSGI programs. > > Is it possible to write a Python WSGI program that talks to a PHP > program as its "back end"? Where can I find out how to do this, > preferably with examples? > > The ideal here is to keep all the existing code as is, but write > little or no new PHP code. Instead, iteratively change the interface, > replacing pieces of the monolithic legacy PHP interface with modular > WSGI programs over time.
Look at mod_python for Apache. If you use it correctly you can on a page by page basis as need be, replace the existing PHP pages with equivalents written using Python. You could do this by programming right at the level of mod_python, or again, if done right by using WSGI on top of mod_python. If you need to maintain compatibility of URLs, you could even do things so that even though URLs use .php, that it maps to Python code underneath, thus easing any transition. If you are interested in this path, the mod_python mailing list may be a good place to go to discuss the mod_python aspects of this. The mod_python mailing list details are on the mod_python web site at www.modpython.org. Graham -- http://mail.python.org/mailman/listinfo/python-list