Skip to content

Instantly share code, notes, and snippets.

@troter
Created March 1, 2013 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save troter/5063712 to your computer and use it in GitHub Desktop.
Save troter/5063712 to your computer and use it in GitHub Desktop.
run reviewboard with tornado (without apache)
#!/bin/env python
execfile('./htdocs/reviewboard.wsgi')
from tornado.options import options, define, parse_command_line
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
define('port', type=int, default=8080)
def main():
tornado.options.parse_command_line()
wsgi_app = tornado.wsgi.WSGIContainer(application)
tornado_app = tornado.web.Application([
(r"/favicon.ico", tornado.web.RedirectHandler, {"url": "/static/rb/images/favicon.png"}),
(r"/static/(.*)", tornado.web.StaticFileHandler, {"path": "./htdocs/static"}),
(r"/media/(.*)", tornado.web.StaticFileHandler, {"path": "./htdocs/media"}),
(r"/errordocs/(.*)", tornado.web.StaticFileHandler, {"path": "./htdocs/errordocs"}),
('.*', tornado.web.FallbackHandler, dict(fallback=wsgi_app)),
])
server = tornado.httpserver.HTTPServer(tornado_app)
server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment