Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (38 sloc) 1.4 KB

PigWig

.. py:module:: 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

  1. if you want to use templating, you must either install jinja2 or provide your own template engine
  2. if you want to use :func:`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 X
  3. you 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

.. toctree::
   :maxdepth: 2

   pigwig
   request_response
   multipart
   exceptions

indices and tables

You can’t perform that action at this time.