The configuration module is accessible via the pylons module.
This module supplies PylonsConfig which handles setting up defaults for templating systems, Paste errorware, and prefixing Routes if necessary.
{'buffet.template_options': {}, 'pylons.request_options': {'errors': 'replace', 'decode_param_names': False, 'charset': 'utf-8', 'language': 'en-us'}, 'pylons.paths': {'controllers': None, 'templates': [], 'static_files': None, 'root': None}, 'pylons.environ_config': {}, 'pylons.db_engines': {}, 'pylons.strict_c': False, 'pylons.h': None, 'pylons.package': None, 'debug': False, 'pylons.g': None, 'buffet.template_engines': [], 'pylons.response_options': {'headers': {'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}, 'errors': 'strict', 'charset': 'utf-8', 'content_type': 'text/html'}}
{'buffet.template_engines': [],
'buffet.template_options': {},
'debug': False,
'pylons.db_engines': {},
'pylons.environ_config': {},
'pylons.g': None,
'pylons.h': None,
'pylons.package': None,
'pylons.paths': {'controllers': None,
'root': None,
'static_files': None,
'templates': []},
'pylons.request_options': {'charset': 'utf-8',
'decode_param_names': False,
'errors': 'replace',
'language': 'en-us'},
'pylons.response_options': {'charset': 'utf-8',
'content_type': 'text/html',
'errors': 'strict',
'headers': {'Cache-Control': 'no-cache',
'Pragma': 'no-cache'}},
'pylons.strict_c': False}
{'charset': 'utf-8',
'decode_param_names': False,
'errors': 'replace',
'language': 'en-us'}
{'charset': 'utf-8',
'content_type': 'text/html',
'errors': 'strict',
'headers': {'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}}
Pylons configuration object
The Pylons configuration object is a per-application instance object that retains the information regarding the global and app conf's as well as per-application instance specific data such as the mapper, the paths for this instance, and the myghty configuration.
The config object is available in your application as the Pylons global pylons.config. An example usage:
1 2 3 | from pylons import config template_paths = config['pylons.paths']['templates'] |
There's several useful keys of the config object most people will be interested in:
This class contains 14 members.
See the source for more information.