Skip to content

Instantly share code, notes, and snippets.

@cjgiridhar
Created August 28, 2012 14:19
Show Gist options
  • Save cjgiridhar/3498429 to your computer and use it in GitHub Desktop.
Save cjgiridhar/3498429 to your computer and use it in GitHub Desktop.
Tornado - Options - 4
port="8000"
host="localhost"
databse="mydb"
user="root"
password="root"
from tornado.options import define, options
import tornado.web
import tornado.database
define("port", default="8888")
class DBHandler(tornado.web.RequestHandler):
def get(self):
self.write("Main")
application = tornado.web.Application([
(r"/db", DBHandler),
], debug=True)
if __name__ == '__main__':
tornado.options.parse_config_file("config.py")
application.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment