Today at work I needed a http server with python to test a script that outputs something to the web. I couldn't find one near by. hadn't the time nor the will to setup one, I just postponed the task to another moment. Few seconds later WSGI came to my mind. Yes, why searching for python server when there is a http server in the paste package ? All I need is two lines of code:
voila !
The my_wsgi_app wrapper takes few lines:
that's all. Start the wsgi server as described above and point the browser to http://127.0.0.1:8080/ . See the results in IE, FireFox or whatsoever.
Yes, all I needed is to use my brain even under tiredness :-)
from paste import httpserver
httpserver.serve(my_wsgi_app, host='127.0.0.1', port='8080')
voila !
The my_wsgi_app wrapper takes few lines:
from my_project import *
def my_wsgi_app(environ,start_response):
start_response('200 OK', [('content-type', 'text/html')])
#
# do logic here
#
return results_you_want_to_show
that's all. Start the wsgi server as described above and point the browser to http://127.0.0.1:8080/ . See the results in IE, FireFox or whatsoever.
Yes, all I needed is to use my brain even under tiredness :-)