WSGI¶
The Web Server Gateway Interface (WSGI) is a specification for simple and universal
interface between web servers and web applications
or frameworks for the Python programming language. 1
So nanohttp application designed with WSGI (originally specified as PEP333) standards, this sample show you how to use it:
wsgi.py
from nanohttp import Application, Controller, html, configure
class RootController(Controller):
@html
def index(self):
return '<h1>HelloWorld!</h1>'
configure()
app = Application(root=RootController())
We need a WSGI server like gunicorn or uWSGI to serve application.
for example with gunicorn:
$ gunicorn -b :8080 wsgi:app
now application can accessible through the browser in http://localhost:8080.
—