How to create "cross-backend" python web app

M

matt

Hi all-

I'm trying to port an ajax spell-checker
(http://www.broken-notebook.com/spell_checker/index.php) to use with
the moin moin wiki and have been somewhat successful. (By successful I
mean I can spell check using the php backend and my python port running
as cgi-bin).

My question is this: moinmoin runs on many python web backends
(cgi-bin/mod-python/twisted/standalone). My spell-checker backend runs
as cgi (disclaimer: I've done a bit of php and java(struts) web app
programming, but the last python related web programming I did was Zope
about 5 years ago (does that even count ? ;) )) because that was the
easiest for me to get up to speed on. What is the best way to write
cross-backend python web apps? Is there any abstraction I can use?
With cgi-bin, I use the python "cgi" module, which gives me easy access
to form variables, but I'd like to be able to deploy in the other
backends as well. What's the best way to do this? Or is a rewrite
required for each one?

thanks

matt
 
P

Paul Boddie

matt said:
Hi all-

I'm trying to port an ajax spell-checker
(http://www.broken-notebook.com/spell_checker/index.php) to use with
the moin moin wiki and have been somewhat successful. (By successful I
mean I can spell check using the php backend and my python port running
as cgi-bin).

That looks like an interesting application/component.
My question is this: moinmoin runs on many python web backends
(cgi-bin/mod-python/twisted/standalone). My spell-checker backend runs
as cgi (disclaimer: I've done a bit of php and java(struts) web app
programming, but the last python related web programming I did was Zope
about 5 years ago (does that even count ? ;) )) because that was the
easiest for me to get up to speed on. What is the best way to write
cross-backend python web apps? Is there any abstraction I can use?

Although a kind of Web "middleware" standard called WSGI [1] has been
proposed to somehow alleviate these kinds of problems, I'd recommend
using WebStack [2] to implement a "cross-backend" solution which will
run on CGI, mod_python, Twisted, BaseHTTPServer and other
technologies.
With cgi-bin, I use the python "cgi" module, which gives me easy access
to form variables, but I'd like to be able to deploy in the other
backends as well. What's the best way to do this? Or is a rewrite
required for each one?

Some might argue that writing directly to WSGI would allow you to
re-use your CGI-based code moderately easily whilst having some
backend portability. I'd argue that WebStack's API is slightly more
high-level and that the WebStack distribution should provide you with
everything you need to deploy your application on the backends you've
chosen (plus others). Either way, you certainly don't need to rewrite
your application for every different environment any more.

Paul

[1] http://www.python.org/peps/pep-0333.html
[2] http://www.python.org/pypi/WebStack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top