Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (51 sloc) 1.42 KB
# -*- coding: utf-8 -
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# Run this application with:
# $ gunicorn multiapp:app
# And then visit:
from routes import Mapper
print "This example requires Routes to be installed"
# Obviously you'd import your app callables
# from different places...
from test import app as app1
from test import app as app2
class Application(object):
def __init__(self): = Mapper()'app1', '/app1url', app=app1)'app2', '/app2url', app=app2)
def __call__(self, environ, start_response):
match =
if not match:
return self.error404(environ, start_response)
return match[0]['app'](environ, start_response)
def error404(self, environ, start_response):
html = """\
<title>404 - Not Found</title>
<h1>404 - Not Found</h1>
headers = [
('Content-Type', 'text/html'),
('Content-Length', str(len(html)))
start_response('404 Not Found', headers)
return [html]
app = Application()
Jump to Line
Something went wrong with that request. Please try again.