0
|
1 #!/usr/bin/env python
|
|
2
|
|
3 from relocator import Relocator
|
|
4 from webob import exc
|
|
5
|
|
6 def sample_app(environ, start_response):
|
|
7 """sample app that does a redirect"""
|
|
8 response = exc.HTTPSeeOther(location='/foo/bar')
|
|
9 return response(environ, start_response)
|
|
10
|
|
11 def sample_factory(baseurl='http://example.com/toolbox'):
|
|
12 """create a webob view and wrap it in the relocator"""
|
|
13 return Relocator(sample_app, baseurl)
|
|
14
|
|
15 if __name__ == '__main__':
|
|
16 from wsgiref import simple_server
|
|
17 app = sample_factory()
|
|
18 server = simple_server.make_server(host='0.0.0.0', port=12345, app=app)
|
|
19 server.serve_forever()
|