2013-01-14 36 views
0

我用下面的命令来启动脚本启动时:CherryPy的:获取应用程序的配置设置与cherryd

cherryd -c tiny.cfg -i tiny 

但我无法读取应用程序配置设置(数据库)。哪里不对?

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 

tiny.cfg

[global] 
server.socket_host: "0.0.0.0" 

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

回答

1

尝试通过你的配置到tree.mount以及拨打:

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

相关问题