def run(self):
import tornado.autoreload
tornado.autoreload.watch('index.wsgi')
import re
from tornado.web import URLSpec, StaticFileHandler
# The user should not use `tornado.web.Application.add_handlers`
# since here in SAE one application only has a single host, so here
# we can just use the first host_handers.
handlers = self.application.handlers[0][1]
for prefix, path in self.static_files.iteritems():
pattern = re.escape(prefix) + r"(.*)"
handlers.insert(0, URLSpec(pattern, StaticFileHandler, {"path": path}))
os.environ['sae.run_main'] = '1'
import tornado.ioloop
from tornado.httpserver import HTTPServer
server = HTTPServer(self.application, xheaders=True)
server.listen(self.conf.port, self.conf.host)
tornado.ioloop.IOLoop.instance().start()
dev_server.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录