vigiboard / vigiboard / websetup.py @ 5dbfa80d
History | View | Annotate | Download (802 Bytes)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
"""Setup the vigiboard application"""
|
3 |
|
4 |
import logging |
5 |
|
6 |
from vigiboard.config.environment import load_environment |
7 |
from vigilo.turbogears import populate_db |
8 |
|
9 |
__all__ = ['setup_app']
|
10 |
|
11 |
log = logging.getLogger(__name__) |
12 |
|
13 |
|
14 |
def setup_app(command, conf, variables): |
15 |
"""Place any commands to setup vigiboard here"""
|
16 |
load_environment(conf.global_conf, conf.local_conf) |
17 |
populate_db() |
18 |
|
19 |
def init_db(): |
20 |
"""
|
21 |
Cette fonction est appelée par le script vigiboard-init-db
|
22 |
pour initialiser la base de données de VigiBoard.
|
23 |
"""
|
24 |
from paste.script.appinstall import SetupCommand |
25 |
import os.path |
26 |
|
27 |
ini_file = '/etc/vigilo/vigiboard/settings.ini'
|
28 |
ini_file = os.path.join('/', *ini_file.split('/')) |
29 |
|
30 |
cmd = SetupCommand('setup-app')
|
31 |
cmd.run([ini_file]) |
32 |
|