def __init__(self, port, **settings): settings['template_path'] = os.path.join(os.getcwd(), 'templates') app = web.Application(include(r'^/', 'urls'), **settings) server = httpserver.HTTPServer(app) if settings['debug']: server.listen(port) else: server.bind(port) server.start(0) ioinst = ioloop.IOLoop.instance() app.asynchronize = asynchronize(ioinst) app.translators = self.install_translators() try: print 'Starting on 0.0.0.0:%s' % port ioinst.start() except: ioinst.stop()
from ramen.urls import pattern, include from tornado.web import StaticFileHandler from settings import settings patterns = pattern( include(r'', 'apps.home.urls', namespace = 'home'), (r'assets/(.*)$', StaticFileHandler, {'path': settings['static_path']}), )