Commits

Sylvain Hellegouarch committed 7978dc0

how to access per-app settings

  • Participants
  • Parent commits d4395a6
  • Branches cp4

Comments (0)

Files changed (1)

File sphinx/source/basics.rst

 Both methods have the same effect so pick the one
 that suits your style best.
 
+You can add settings that are not specific to a request URL
+and retrieve it from your page handler as follow:
+
+.. code-block:: ini
+		
+   [/]
+   tools.gzip.on: True
+
+   [googleapi]
+   key = "..."
+   appid = "..."
+   
+.. code-block:: python
+
+   class Root(object):
+       @cherrypy.expose
+       def index(self):
+           google_appid = cherrypy.request.app.config['googleapi']['appid']
+           return "hello world!"
+
+   cherrypy.quickstart(Root(), '/', "app.conf")
+
+
 Cookies
 #######