如何使用HTTPS在CherryPy WSGI服务器(Cheroot)上为Flask应用程序的文件启用错误日志记录?

时间:2019-07-03 11:01:26

标签: flask cherrypy

如何在HTTPS上使用cheroot记录错误并访问物理文件?

这似乎适用于CherryPy

cherrypy.config.update({'log.error_file': Web.log,
                'log.access_file': Access.log
               })

我需要更改此代码以适应文件记录:

from cheroot.wsgi import Server as WSGIServer
from cheroot.wsgi import PathInfoDispatcher as WSGIPathInfoDispatcher
from cheroot.ssl.builtin import BuiltinSSLAdapter

from MyFlaskApp import app

my_app = WSGIPathInfoDispatcher({'/': app})
server = WSGIServer(('0.0.0.0', 443), my_app)

ssl_cert = "[path]/myapp.crt"
ssl_key = "[path]/myapp.key"
server.ssl_adapter =  BuiltinSSLAdapter(ssl_cert, ssl_key, None)

if __name__ == '__main__':
   try:
      server.start()
   except KeyboardInterrupt:
      server.stop()

0 个答案:

没有答案