Python web service ...

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Sat Aug 26 11:16:16 EDT 2006


On 26 Aug 2006 04:07:35 -0700, nicolasg at gmail.com <nicolasg at gmail.com> wrote:
> Hi folks, I have accomplished to make a python program that make some
> image manipulation to bmp files.
> I now want to provide this program as a web service. A user can visit a
> site and through a web interface he should upload the file to the web
> server , the server then will do the image process with the python
> program I have wrote and when it finish the user must get the image
> file back .
>
> My question is how difficult is to set up a web server that can run
> python easy ? should I try ZOPE or there is something better in mind ?
>

For a one-shot thing, plain old CGI might be enough. You can have a
static HTML page with the form for the upload, have python do the
image part, and generate the return HTML with the image with a python
script.  If you plan to do this a lot, or want fairly sophisticated
stuff, or DB access underneath, authentication, etc, then you might
want to look at any of the web framewoks. If you don't have the web
server part already taken care of (e.g., you already have Apache up
and running) then the web server framework can be more attractive.

As for web frameworks there is a long list in the Python web site.
Which framework fits you best might depend on what you want to
accomplish now and in the future. You can try something simple and
minimalist (and with docs that you can read in less than an afternoon)
such as Karrigell, or try something more complex, such as Django,
TurboGears, Pylons, CherryPy, etc.

And then, you might try the CGI approach to begin with, and as your
needs become more complex, move to a framework. (This has been our own
path: we've used plain CGI for over a year for the web-based
bioinformatics applications we've developed, that use R and Python for
computations, and are now moving to  framework).

Good luck!

R.

-- 
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz



More information about the Python-list mailing list