simplest way to create simple standalone wsgi server without import wsgi_lib.server

Gelonida gelonida at
Tue Feb 1 17:01:15 EST 2011

On 02/01/2011 03:07 AM, Jean-Paul Calderone wrote:
> On Jan 31, 5:28 pm, Gelonida <gelon... at> wrote:
>> Hi,
>> Normally I use following code snippet to quickly test a wsgi module
>> without a web server.
>> import wsgi_lib.server
>>, port=port)
>> However Now I'd like to test a small wsgi module on a rather old host
>> ( Python 2.4.3 ) where I don't have means to update python.
>> Is there any quick and easy code snippet / module, performing the same
>> task as my above mentioned lines?
>> Thanks in advance for any hints
> You didn't mention why you can't update Python, or if that means you
> can't install new libraries either.  However, if you have Twisted 8.2
> or newer, you can replace your snippet with this shell command:
>     twistd -n web --port <port> --wsgi <application>

Thanks Jean-Paul

The problem is rather simple. The host in question is not 100% under my
control. I can request to have packages installed if they're in the list
of available packages.

python 2.4 is part of it. twisted is not

In the worst case I could request the installation of python virtualenv,
the entire gcc tool chain and try to compile twisted,
or wsgilib, but I wondered whether there isn't a simple pure python way
of starting a wsgi server for test purposes.

> <application> is the fully-qualified Python name of your application
> object.  So, for example if you have a module named "foo" that defines
> an "application" name, you would pass "foo.application".
> Jean-Paul

More information about the Python-list mailing list