我在尝试这个:
favicon_path = '/path/to/favicon.ico'
settings = {'debug': True,
'static_path': os.path.join(PATH, 'static')}
handlers = [(r'/', WebHandler),
(r'/favicon.ico', tornado.web.StaticFileHandler, {'path': favicon_path})]
application = tornado.web.Application(handlers, **settings)
application.listen(port)
tornado.ioloop.IOLoop.instance().start()
Run Code Online (Sandbox Code Playgroud)
但是它一直favicon.ico在我的static_path中提供服务(我在两个不同favicon.ico的路径中有两个不同的路径,如上所示,但我希望能够覆盖它中的那个static_path).
我想用Python提供静态文件.Python 3是否http.server适合在生产中使用?如果没有,为什么不呢?我还有什么选择?