Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何运行瓶子&x2B;龙卷风&x2B;ssl(https)和#x2B;斯普迪_Python_Ssl_Tornado_Bottle_Spdy - Fatal编程技术网

Python 如何运行瓶子&x2B;龙卷风&x2B;ssl(https)和#x2B;斯普迪

Python 如何运行瓶子&x2B;龙卷风&x2B;ssl(https)和#x2B;斯普迪,python,ssl,tornado,bottle,spdy,Python,Ssl,Tornado,Bottle,Spdy,我将python框架瓶子与Web服务器tornado一起使用。这是我的init.py: import bottle import os # Init application bottle.run(host="127.0.0.1", app=app, port=int(os.environ.get("PORT", 5000)), server='tornado') 如何通过HTTPS进行连接 我读了这篇文章 但这是关于CherryPy服务器的 有可能在龙卷风中使用SPDY吗?怎么用?

我将python框架瓶子与Web服务器tornado一起使用。这是我的
init.py

import bottle
import os

# Init application
bottle.run(host="127.0.0.1", app=app, port=int(os.environ.get("PORT", 5000)), server='tornado')
  • 如何通过HTTPS进行连接
我读了这篇文章 但这是关于CherryPy服务器的


  • 有可能在龙卷风中使用SPDY吗?怎么用? (我在GitHub上找到TornadosSpdy,但没有解释如何使用它)


您最好的选择是使用代理前端服务器,如nginx、haproxy或apache。用ssl配置tornado的速度非常慢,它会将tornado的速度降低到爬行的速度,直到它完全没有响应为止,只需要很少的访问。我已经到处寻找,直接使用tornado在ssl通信中获得了相当快的速度,但没有找到任何。此外,使用前端服务器也不错

但是通过使用apachef.ex。作为前端代理,我接近于本机的非ssl速度

但使用ssl配置tornado很简单:

def main():
    handlers = [
        (r"/", HomeHandler),
    ]
    settings = dict(
       blog_title=u"Tornado Blog",
        template_path=os.path.join(os.path.dirname(__file__), "templates"),
        static_path=os.path.join(os.path.dirname(__file__), "static"),
        cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
        debug=True,
        certfile = os.path.join("certs/server.crt"),
        keyfile = os.path.join("certs/server.key"),
        ssl_options = {
            "certfile" : os.path.join("certs/server.crt"),
            "keyfile" : os.path.join("certs/server.key"),
        },
    )
    tornado.options.parse_command_line()
    http_server = tornado.httpserver.HTTPServer(Application())
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()

main()