I am working on a CherryPy application based on what I found on this B itBucket repository .
As in this example, there are two configuration files: server.cfg (aka "global") and app.cfg.
Both configuration files are loaded into the serve.py file :
cherrypy.config.update(os.path.join(self.conf_path, "server.cfg"))
from webapp.app import Twiseless
webapp = Twiseless()
app = cherrypy.tree.mount(webapp, '/', os.path.join(self.conf_path, "app.cfg"))
Now I would like to add a database configuration. My first thought was to add it to server.cfg (is this the best place? Or should it be located in app.cfg?).
But if I add the database configuration to server.cfg, I don’t know how to access it. Using:
cherrypy.request.app.config['Database']
It works only if the [Database] parameter is in app.cfg.
cherrypy.request.app.config, , app.cfg, server.cfg.
, :
- server.cfg app.cfg.
- server.cfg(aka global)
!:)