wsgisubdomain is a WSGI application dispatcher. A WSGI application is fetched based on a request’s target subdomain, creating one if needed.

wsgisubdomain supports Python 2.6, 2.7, 3.2, 3.3 and PyPy.

The code in this module is adapted from:


$ pip install wsgisubdomain


# app.wsgi
from wsgisubdomain import SubdomainDispatcher
from app import create_application
application = SubdomainDispatcher(create_application)


Subdomain Dispatcher

class wsgisubdomain.SubdomainDispatcher(create_application)[source]

A WSGI application that gets or creates other WSGI applications based on the subdomain.

Adapted from:

Parameters:create_application – A function that accepts ‘subdomain’ as a keyword argument and returns a WSGI application. Subdomain will be either an empty string for the bare domain, None if the request is for an IP address, or a full subdomain (e.g. ‘www’ or ‘en.dl’)
__call__(environ, start_response)[source]

WSGI application interface

  • environ – WSGI environ
  • start_response – WSGI start_response

x.__delattr__(‘name’) <==> del


default object formatter


x.__getattribute__(‘name’) <==>


x.__hash__() <==> hash(x)

static __new__(S, ...) → a new object with type S, a subtype of T

helper for pickle


helper for pickle


x.__repr__() <==> repr(x)


x.__setattr__(‘name’, value) <==> = value

__sizeof__() → int

size of object in memory, in bytes


x.__str__() <==> str(x)

static __subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).


list of weak references to the object (if defined)


Retrieve an application for a wsgi environ

Parameters:environ – The environ object sent by wsgi to an application

Table Of Contents

Related Topics

This Page

Fork me on GitHub