Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (18 sloc) 654 Bytes
layout title
default
Subdomain application

Subdomain application

Subdomain applications delegate requests based on host. This makes virtual hosting very easy. This works like a subdir application, only switches to the corresponding application based on host name instead of sub directory.

Example

 import mainsite 
 import wiki
 import usersite

 mapping = ( 
     "(www\.)?example.com", mainsite.app, 
     "wiki.example.com", wiki.app,
     ".*\.example.com", usersite.app 
 ) 

 app = web.subdomain_application(mapping)

 if __name__ == '__main__':
     app.run()