Posted By

surfeurX on 11/11/09


Tagged

python wsgi


Versions (?)

urlrelay


 / Published in: Python
 

  1. import urlrelay
  2. from webob import Request, Response
  3. from paste import httpserver
  4.  
  5. @urlrelay.url('^/$')
  6. def index(environ, start_response):
  7. response = Response()
  8. response.body = "bonjour"
  9. return response(environ, start_response)
  10.  
  11. @urlrelay.url('^/activate/(?P<code>\w+)$')
  12. def activate(environ, start_response):
  13. code = environ['wsgiorg.routing_args'][1]['code']
  14. response = Response()
  15. response.body = code
  16. return response(environ, start_response)
  17.  
  18. app = urlrelay.URLRelay()
  19.  
  20. if __name__ == '__main__':
  21. httpserver.serve(app, host='127.0.0.1', port='8000')

Report this snippet  

You need to login to post a comment.