Skip to main content
Help us improve Python packaging – donate today!

A WSGI routing apparatus.

Project Description

Decorouter is a WSGI routing apparatus that makes it easy to define routes using decorator syntax.

Example:

from decorouter import Router

class MyApplication:
    router = Router()

    @router.add('/$')
    def index(self, environ, start_response):
        start_response('200 OK', [('Content-type', 'text/plain')])
        return ['Hello, world!']

    @router.add('/hello/([^/]+)$')
    def index(self, environ, start_response):
        args, kwargs = environ['wsgiorg.routing_args']
        (name,) = args
        start_response('200 OK', [('Content-type', 'text/plain')])
        return ['Hello, %s!' % (name,)]

    def __call__(self, environ, start_response):
        return self.router(environ, start_response)

if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    make_server('', 8000, MyApplication()).serve_forever()

Release history Release notifications

This version
History Node

0.0.2

History Node

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
decorouter-0.0.2.tar.gz (3.4 kB) Copy SHA256 hash SHA256 Source None Nov 2, 2011

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page