Mercurial > bottledash
comparison dash.py @ 10:d71f39618d6f
used another workaround to locate the correct template
author | sean |
---|---|
date | Wed, 29 Jul 2015 12:27:26 +0200 |
parents | b06cb7fbf7f8 |
children | 3a9cb396905f |
comparison
equal
deleted
inserted
replaced
9:b06cb7fbf7f8 | 10:d71f39618d6f |
---|---|
4 license: GNU >= V2. See LICENSE for details | 4 license: GNU >= V2. See LICENSE for details |
5 """ | 5 """ |
6 | 6 |
7 from bottle import get, post, request, view, response, route | 7 from bottle import get, post, request, view, response, route |
8 from bottle import template, run, static_file, error | 8 from bottle import template, run, static_file, error |
9 import os.path,sys,configparser | 9 import os.path,sys,configparser,functools,bottle |
10 | 10 |
11 CONFIG_FILE = "dash.conf" | 11 CONFIG_FILE = "dash.conf" |
12 PATH = os.path.abspath(os.path.dirname(sys.argv[0])) | 12 PATH = os.path.abspath(os.path.dirname(sys.argv[0])) |
13 CONFIG_PATH = PATH + "/" + CONFIG_FILE | 13 CONFIG_PATH = PATH + "/" + CONFIG_FILE |
14 | 14 |
15 # Create a new list with absolute paths | 15 # Create a new list with absolute paths |
16 MY_TEMPLATE_PATH = [ | 16 MY_TEMPLATE_PATH = [ |
17 PATH, './views')), | 17 os.path.abspath(os.path.join(os.path.dirname(__file__), './views')), |
18 ] | 18 ] |
19 | 19 |
20 # Patch @view() so it uses the customized path list instead of the global one | 20 # Patch @view() so it uses the customized path list instead of the global one |
21 view = functools.partial(bottle.view, template_lookup=MY_TEMPLATE_PATH) | 21 view = functools.partial(bottle.view, template_lookup=MY_TEMPLATE_PATH) |
22 | 22 |
23 tiles = [] | 23 tiles = [] |
24 settings = {} | 24 settings = {} |
25 | 25 |
26 default_settings = configparser.ConfigParser() | 26 default_settings = configparser.ConfigParser() |
27 default_settings['settings'] = {'show_top_bar': True} | 27 default_settings['settings'] = {'show_top_bar': False} |
28 | 28 |
29 ##read the config file. usually "dash.conf" | 29 ##read the config file. usually "dash.conf" |
30 | 30 |
31 def read_config(): | 31 def read_config(): |
32 | 32 |