Revision b82c4c03
[#1510] Chargement plus générique de l'application
Rend plus générique le chargement des IHMs :
- Le dossier de surcharge (public/) est pris à partir de l'emplacement
du fichier settings.ini plutôt que hard-codé.
- Idem pour le fichier app_cfg.py.
Ces modifications permettent d'héberger plusieurs instances de VigiMap
conjointement sur la même machine (par exemple, pour PreludeMap).
Change-Id: Iaf43087160023a7eda95c3d366a336ba17e0b93f
Refs: #1510.
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/1926
Tested-by: Build system <qa@vigilo-dev.si.c-s.fr>
Reviewed-by: Francois POIROTTE <francois.poirotte@c-s.fr>
vigiboard/websetup.py | ||
---|---|---|
22 | 22 |
# pylint: disable-msg=W0613 |
23 | 23 |
# W0613: Unused arguments: on doit respecter l'API |
24 | 24 |
|
25 |
import imp |
|
26 |
|
|
25 | 27 |
__all__ = ['setup_app', 'populate_db'] |
26 | 28 |
|
27 | 29 |
def _(msg): |
... | ... | |
36 | 38 |
def setup_app(command, conf, variables): |
37 | 39 |
"""Place any commands to setup vigiboard here""" |
38 | 40 |
from vigilo.turbogears import populate_db as tg_pop_db |
39 |
from vigiboard.config.environment import load_environment |
|
40 | 41 |
|
42 |
# Charge le fichier "app_cfg.py" se trouvant aux côtés de "settings.ini". |
|
43 |
mod_info = imp.find_module('app_cfg', [ conf.global_conf['here'] ]) |
|
44 |
app_cfg = imp.load_module('vigiboard.config.app_cfg', *mod_info) |
|
45 |
|
|
46 |
# Initialisation de l'environnement d'exécution. |
|
47 |
load_environment = app_cfg.base_config.make_load_environment() |
|
41 | 48 |
load_environment(conf.global_conf, conf.local_conf) |
42 | 49 |
tg_pop_db() |
43 | 50 |
|
Also available in: Unified diff