Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Another WSGI Framework

Project Description
![TravisCI Status](

# About

I wanted a framework that was based around
[routes]( and
[webob]( without opinionation about database and

Some of the specifics of this are inspired/copied from:

# Installation

`pip install corker`

# Usage

The basics are that you create controllers (classes that subclass
`BaseController`). In a controller, you label methods with the `@route`
decorator to expose them. You then invoke your controller's
`setup_routes` method (inheritted from `BaseController`), passing it a
routes mapper to add itself to. Then, to create the actual wsgi app,
you create an `Application` and pass it the mapper.

In a controller, `self.request` gives you the current WebOb request
object. The controller can return a string containing HTML (in which
case it will be given a status code of 200), or a WebOb response object.
Additionally, it is safe to raise any
[WebOb exception](

On an exposed method, the arguments (after self) are from routes
positional/regex arguments. GET and POST arguments are accessed via

The arguments for the `@route` decorator largely match the arguments for
route's `mapper.connect` method. The decorated method is automatically
used as the action argument to `mapper.connect` and all other arguments
to `@route` are passed through to `mapper.connect` as is.

Arguments passed to `Application` after the mapper are inserted into
controllers with the same name. So, is the `Application` was
instantiated with `Application(mapper, x=5)`, then in an exposed method
on the controller, `self.x == 5` would be `True`.

## Example

from routes import Mapper

from corker.controller import BaseController, route
from import Application
from webob import Response

class Index(BaseController):
def index(self, request):
return 'Hi index!\n'

def view(self, request, item):
return 'Hi view %d!\n' % int(item)

class Sub(BaseController):
def __init__(self, request, arg1):
self.request = request
self.arg1 = arg1

def index(self, request):
return Response('Hi sub!\n' + self.arg1)

mapper = Mapper()
with mapper.submapper(path_prefix='/sub') as sub:
Sub.setup_routes(sub, config={"arg1": "arg string"})

example_app = Application(mapper)

# At that point `example_app` is a wsgi app ready to be mounted by the
# server of your choice. For example with `wsgiref`:

from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server

httpd = make_server('', 8000, example_app)
print "Serving on port 8000..."

# Bugs/Feature Requests

See [github issues](

# Copyright
This is distributed as BSD. Copyright Joshua D. Boyd
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
corker-0.6.0.tar.gz (5.9 kB) Copy SHA256 Checksum SHA256 Source Sep 27, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting