1 | import os |
---|
2 | |
---|
3 | import pylons.config |
---|
4 | import webhelpers |
---|
5 | |
---|
6 | from ows_server.config.routing import make_map |
---|
7 | |
---|
8 | def load_environment(global_conf={}, app_conf={}): |
---|
9 | map = make_map(global_conf, app_conf) |
---|
10 | # Setup our paths |
---|
11 | root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
---|
12 | paths = {'root_path': root_path, |
---|
13 | 'controllers': os.path.join(root_path, 'controllers'), |
---|
14 | 'templates': [os.path.join(root_path, path) for path in \ |
---|
15 | ('components', 'templates')], |
---|
16 | 'static_files': os.path.join(root_path, 'public') |
---|
17 | } |
---|
18 | |
---|
19 | # The following template options are passed to your template engines |
---|
20 | tmpl_options = {} |
---|
21 | tmpl_options['myghty.log_errors'] = True |
---|
22 | tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format) |
---|
23 | |
---|
24 | # Add your own template options config options here, note that all config options will override |
---|
25 | # any Pylons config options |
---|
26 | |
---|
27 | # Return our loaded config object |
---|
28 | return pylons.config.Config(tmpl_options, map, paths) |
---|