0

我使用以下命令启动脚本:

cherryd -c tiny.cfg -i tiny

但我无法读取应用程序配置设置(数据库)。怎么了?

微小的.py

import cherrypy

class HelloWorld:
    def index(self):
        return "Hello world!"
    index.exposed = True

app = cherrypy.tree.mount(HelloWorld(), '/')
print 'app.config', app.config
print 'cherrypy.config', cherrypy.config

微小的.cfg

[global]
server.socket_host: "0.0.0.0"

[database]
driver: "mysql"
host: "localhost"
4

1 回答 1

1

尝试将您的配置传递给 tree.mount 调用:

app = cherrypy.tree.mount(HelloWorld(), '/', 'tiny.cfg')

于 2013-01-14T20:24:25.060 回答