summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLawouach <sh@defuze.org>2014-05-13 21:55:44 +0200
committerLawouach <sh@defuze.org>2014-05-13 21:55:44 +0200
commit94aa1623a8162bf946ce68c6b74e16efaaa87bc1 (patch)
tree4493015a9cd3fc67d23851f2dd5e4ff363e558f7
parentcb8cac6f060e893c285baea740f6c3c5130b31c6 (diff)
downloadcherrypy-94aa1623a8162bf946ce68c6b74e16efaaa87bc1.tar.gz
how to access per-app settings
-rw-r--r--sphinx/source/basics.rst23
1 files changed, 23 insertions, 0 deletions
diff --git a/sphinx/source/basics.rst b/sphinx/source/basics.rst
index 7cdcbf85..e559b803 100644
--- a/sphinx/source/basics.rst
+++ b/sphinx/source/basics.rst
@@ -321,6 +321,29 @@ A variant notation to the above:
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
#######