I use the following command to start the script:
cherryd -c tiny.cfg -i tiny
But I cannot read the app config settings (database). What is wrong?
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"
Try passing your config to the tree.mount call as well:
app = cherrypy.tree.mount(HelloWorld(), '/', 'tiny.cfg')