source: MILK/trunk/milk_server/milk_server/config/environment.py @ 4467

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/MILK/trunk/milk_server/milk_server/config/environment.py@5913
Revision 4467, 2.0 KB checked in by cbyrom, 12 years ago (diff)

Strip out code not relevant to MILK - mainly WCS and WMS stuff - also including the CSML server code + trackback code
Also tidy up structure of 'public' dir - setting up new 'style' dir and
centralising icons in icons dir + remove all unused icons, javascript and stylesheets.
Also strip out testcase code and populate new test directory structure.

Line 
1import os
2
3import webhelpers
4
5from pylons import config
6
7import milk_server.lib.app_globals as app_globals
8import milk_server.lib.helpers
9from milk_server.config.routing import make_map
10
11# Set-up tools package import for locating NDG Security SSO Service
12import pkg_resources
13
14import logging
15log = logging.getLogger(__name__)
16
17
18def load_environment(global_conf={}, app_conf={}):
19    # Setup our paths
20    root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
21    paths = {'root': root_path,
22             'controllers': os.path.join(root_path, 'controllers'),
23             'templates': [os.path.join(root_path, path) for path in \
24                           ('components', 'templates')],
25             'static_files': os.path.join(root_path, 'public')
26             }
27
28   
29    # Initialize config with the basic options
30    config.init_app(global_conf, app_conf, package='milk_server',
31                    template_engine='kid', paths=paths)
32    config.add_template_engine("genshi", "milk_server.templates", {})
33   
34    config['pylons.g'] = app_globals.Globals()
35    config['pylons.h'] = milk_server.lib.helpers
36    config['routes.map'] = make_map()
37   
38    # The following template options are passed to your template engines
39    tmpl_options = config['buffet.template_options']
40    tmpl_options['myghty.log_errors'] = True
41    tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format)
42   
43    # Add your own template options config options here, note that all config options will override
44    # any Pylons config options 
45   
46    # Add templates for NDG Security Single Sign On Service making sure to
47    # provide an alias to avoid overwriting the default templates dir 
48    kidopts = {'kid.assume_encoding':'utf-8', 'kid.encoding':'utf-8'}
49    config.add_template_engine('kid', 
50                               'ndg.security.server.sso.sso.templates', 
51                               kidopts,
52                               alias='ndg.security.kid')
Note: See TracBrowser for help on using the repository browser.