2013-01-14 37 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')

相關問題