source: DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/config/environment.py @ 3367

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/DPPP/ukcip02_server/trunk/ukcip_server/ukcip_server/config/environment.py@3367
Revision 3367, 1.2 KB checked in by spascoe, 12 years ago (diff)

Work in progress ...

Line 
1"""Pylons environment configuration"""
2import os
3
4from pylons import config
5
6import ukcip_server.lib.app_globals as app_globals
7import ukcip_server.lib.helpers
8from ukcip_server.config.routing import make_map
9
10from ukcip_server.config import ukcip02
11
12def load_environment(global_conf, app_conf):
13    """Configure the Pylons environment via the ``pylons.config``
14    object
15    """
16    # Pylons paths
17    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18    paths = dict(root=root,
19                 controllers=os.path.join(root, 'controllers'),
20                 static_files=os.path.join(root, 'public'),
21                 templates=[os.path.join(root, 'templates')])
22
23    # Initialize config with the basic options
24    config.init_app(global_conf, app_conf, package='ukcip_server',
25                    template_engine='kid', paths=paths)
26
27    config['routes.map'] = make_map()
28    config['pylons.g'] = app_globals.Globals()
29    config['pylons.h'] = ukcip_server.lib.helpers
30
31    # Customize templating options via this variable
32    tmpl_options = config['buffet.template_options']
33
34    # CONFIGURATION OPTIONS HERE (note: all config options will override
35    # any Pylons config options)
36
37    # Initialise the UKCIP02 data
38    ukcip02.load_data()
Note: See TracBrowser for help on using the repository browser.