现在我在同一个文件中有 Tornado 选项,就像在 Tornado 应用程序中一样。他们定义如下:
import tornado.options
tornado.options.define(<name>, default=<value>)
有没有办法将它们移出到单独的文件中?
此外,默认情况下访问的选项如下:
tornado.options.options.<name>
有没有办法像settings.<name>
一样访问它们?
最佳答案
Tornado 的文档非常好。
http://www.tornadoweb.org/en/latest/options.html
The main() method of your application does not need to be aware of all of the options used throughout your program; they are all automatically loaded when the modules are loaded. Your main() method can parse the command line or parse a config file with:
import tornado.options tornado.options.parse_config_file("/etc/server.conf") tornado.options.parse_command_line()
关于python - Tornado 应用程序布局。选项。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10699665/