views:

294

answers:

1

Hi. I'm trying to understand how WSGI works. I know I could read the specs, but I'd still want to know how do I create a spawning application? A complete "hello world".

Could someone show me an example? With everything, file naming, creating the module, running it. Every and each step. Thanks.

(NB: while spawning seems a great piece of software, it has a stupid name: I cannot find anything successfully on the web on the matter, because everything related to "spawning" also relates to "multithreading" or "IPC").

+3  A: 

From what I can see in the documentation, Spawning just runs stock WSGI apps, which means that you just write a WSGI script and then invoke Spawning against it:

spawn helloworld.simple_app
spawn helloworld.simple_app middleware.Upperware

As always, make sure you have installed any modules it depends on, such as paste.deploy.

Ignacio Vazquez-Abrams
I did read the documentation and I did experimented around, but I can't figure out how to write it exactly. Please improve your answer.
Flavius
Save the first snippet under "An example WSGI application" as helloworld.py, the second snippet as middleware.py, and run the above commands.
Ignacio Vazquez-Abrams
The things I've tried give me: "ImportError: No module named paste.deploy", including that example.
Flavius
Did you try installing paste.deploy? http://pythonpaste.org/deploy/
Ignacio Vazquez-Abrams
There's no "paste.deploy" on pypi. I did install paste with easy_install and now it only says: "ImportError: No module named deploy", in an endless loop, like it did earlier with "paste.deploy".
Flavius
I've fixed it by looking on the GIT repository of spawning, last log says it depends on "pastedeploy". Please add this to your response as well as the second comment, so I can accept your answer. Thanks!
Flavius