Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
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']}),
)