PigWig¶
pigwig is a WSGI framework for python 3.4+:
#!/usr/bin/env python3
from pigwig import PigWig, Response
def root(request):
return Response('hello, world!')
def shout(request, word):
return Response.json({'input': word, 'OUTPUT': word.upper()})
routes = [
('GET', '/', root),
('GET', '/shout/<word>', shout),
]
app = PigWig(routes)
if __name__ == '__main__':
app.main()
pigwig has no hard dependencies, but
if you want to use templating, you must either install jinja2 or provide your own template engine
if you want to use
PigWig.main()
for development, the reloader requires a libc that supports inotify (linux 2.6.13 and glibc 2.4 or later) or the macfsevents package on OS Xyou will want a “real” WSGI server to deploy on such as eventlet or gunicorn
see blogwig for a more in-depth example and the readme for FACs