【问题标题】:Integrating fanstatic with tornado web?将 fanstatic 与龙卷风网络集成?
【发布时间】:2012-08-22 15:29:31
【问题描述】:

我正在尝试将 fanstatic.org 与 tornadoweb 集成,并且很好奇是否有人有任何先验知识或任何代码可以反映这是如何完成的?我一直在阅读文档,我相信它可以做到,因为 tornado 确实提供了 wsgi 接口。

谢谢

【问题讨论】:

    标签: python tornado fanstatic


    【解决方案1】:
    import tornado.wsgi
    from fanstatic import Fanstatic   
    
    from your_tornado_app import MainHandler # tornado.web.RequestHandler
    
    app = tornado.wsgi.WSGIApplication([
        (r"/", MainHandler),
    ])
    app = Fantastic(app)
    
    if __name__ == '__main__':
        from wsgiref.simple_server import make_server
    
        server = make_server('127.0.0.1', 8080, app)
        server.serve_forever()
    

    【讨论】:

    • 我希望 fanstatic 不限于 wsgi,因为它会从 tornado 中消除如此多的灵活性
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多