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

Jean-Paul Calderone calderone.jeanpaul at gmail.com
Mon Jan 31 21:07:45 EST 2011


On Jan 31, 5:28 pm, Gelonida <gelon... at gmail.com> wrote:
> Hi,
>
> Normally I use following code snippet to quickly test a wsgi module
> without a web server.
>
> import wsgi_lib.server
> wsgi_lib.server.run(application, 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>

<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