Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (84 sloc) 2.96 KB


The hosts argument contains a dictionary of domains and vroots.

A very basic API, contents of file can be:

Hosts dictionary elements

*:wildcard matching all HTTP_HOSTS

To support multi-tenancy the hosts dictionary is needed.

A dictionary structure is formed by key: value elements, in this case the key is used for specifying the 'host' and the value to specify the vroot

Hosts structure & vroot

The wildcard character * can be used, for example:

  • line 2 matches any host * and will be served on vroot 'default'
  • line 3 matches any host ending with and will be served on vroot 'default'
  • line 4 matches host and will be server on vroot 'ejemplo_org'
  • line 5 matches host and will be served on vroot 'api_ejemplo_org'

Notice that the vroot values use _ as separator instead of a dot, this is to prevent conflicts on how python read files. for example this request:

Internally will be calling something like:

import my_api.api_ejemplo_org.v0.zun_gevent.zun_gevent

Directory structure

The API directory structure for this example would be:

virtual roots (vroot)

default:line 2, 3
ejemplo_org:line 4
api_ejemplo_org:line 5