473,327 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Dumb-as-rocks WSGI serving using standard library

Howdy all,

I'm trying to implement some new functionality for an existing PHP web
application. Rather than writing a whole lot of stuff in PHP, and
looking toward a future when more of the application can be rewritten
more sanely, I'd like to write a Python program that generates the
content and serves it up to the existing application via HTTP.
The existing architecture is as expected:

web client <--(HTTP)--> existing app

with the existing app also talking to a database.

The new functionality involves generating a PDF document from input
parameters and returning it to the browser. Rather than nestle this
into the existing PHP, I'd like the existing app to simply make an
HTTP request to a single-purpose application server written in Python
which generates the content and serves it back as the response body.

This would insert into the above architecture behind the existing
application:

existing app <--(HTTP)--> request server <--(WSGI)--> content generator

The bulk of the new functionality would be in the generation of the
content from the input parameters.

The request server would run locally on the machine, listening for
HTTP requests and invoking the content generator via WSGI; the
generated document would simply be served back as the HTTP response
body.

The existing application would then just need to gather the input
parameters needed, feed them in an HTTP request to the request server,
and feed back the response to the web client.
I can see how writing the content generator to talk WSGI would be
beneficial: the application can be re-used in other application
contexts. The WSGI protocol is easy to follow.

What I can't find is a simple recipe to serve a WSGI application with
a dumb-as-rocks HTTP server, just using the standard Python library.

The standard library includes BaseHTTPServer, which as far as I can
tell doesn't know anything about WSGI.

The don't seem to be any recipes posted to the Python Cookbook
<URL:http://aspn.activestate.com/ASPN/Python/Cookbook/> with "wsgi" in
them.

Everything else that I can find leads to dependencies I don't want for
flexibility I don't need: cherrypy, paste, et al.

Any suggestions for how to serve up a simple WSGI application with
just the standard library?

--
\ "A cynic is a man who, when he smells flowers, looks around for |
`\ a coffin." -- Henry L. Mencken |
_o__) |
Ben Finney

May 22 '06 #1
2 1378
On Mon, 22 May 2006 18:18:34 +1000, Ben Finney wrote:

[...]

Everything else that I can find leads to dependencies I don't want for
flexibility I don't need: cherrypy, paste, et al.

Any suggestions for how to serve up a simple WSGI application with
just the standard library?


the easiest seems to be james: http://wsgiarea.pocoo.org/james/
or
flup: http://www.saddi.com/software/flup/ (for FCGI adapter)

May 22 '06 #2
> What I can't find is a simple recipe to serve a WSGI application with
a dumb-as-rocks HTTP server, just using the standard Python library.

The standard library includes BaseHTTPServer, which as far as I can
tell doesn't know anything about WSGI.

Everything else that I can find leads to dependencies I don't want for
flexibility I don't need: cherrypy, paste, et al.

Any suggestions for how to serve up a simple WSGI application with
just the standard library?


There's no WSGI http server in the std lib as of Python 2.4.

Paste[1] provides one, wsgiref[2] (probably will be included in Python 2.5)
provides a SimpleHTTPServer and CGI based WSGI servers.
There's also WSGIUtils[3] that provides that.

[1] http://pythonpaste.org/
[2] http://svn.eby-sarna.com/wsgiref/
http://www.artima.com/weblogs/viewpo...?thread=158191
[3] http://www.owlfish.com/software/wsgiutils/

--
damjan
May 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: squash | last post by:
a dumb question i had on my mind: Say you have a dynamically created web page . Isn't it more secure to write it in php since a visitor will not be able to tell it is dynamically created? But...
3
by: ed | last post by:
I've just started working with .Net, so appologize for what is probably a really dumb question. Did Windows XP originally come with the .Net framework installed, and if so which version? ...
2
by: InvisibleMan | last post by:
Hi, I feel a little dumb for asking this (considering im writing TSQL) but there doesn't seem to be any definitive answers on the search engines... Okay I understand that if you open the ADO...
2
by: TGF | last post by:
How do you copy a String type into a native char buffer? Dumb question, but not sure how to do it :( TGF
4
by: Stelrad Doulton | last post by:
Hi, Apologies if this isn't the correct forum. I am writing a communication solution (actually on the Compact Framework) based on HttpWebRequests hooking up with custom handlers on the...
1
by: Chris | last post by:
Dumb question about c# web services Posted on: 11/30/2005 12:14:16 Ok guys, here is what I am trying to do or what I need to know. I am creating a webservice called db_update. This...
2
by: Rudy | last post by:
Hi All! A real dumb question, but should be easy, I hope. I created a custom message box, by creating a form. I just want a "OK" button on the message box to close the message box out. I tried...
4
by: rodchar | last post by:
hey all, i've read wikipedia's version and still kinda fuzzy, can someone please give me a dumb down version of imperative vs declartive programming? thanks, rodchar
4
by: theapeman | last post by:
Sorry to bore everyone with this question, which I'm sure is the equivalent of "Please help! What letter comes between C and E in the alphabet?" but seriously, if you really didn't know that, I don't...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.