Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigigraph / vigigraph / websetup.py @ 2d8c18dc

History | View | Annotate | Download (803 Bytes)

1 0931fc44 Thomas BURGUIERE
# -*- coding: utf-8 -*-
2
"""Setup the vigigraph application"""
3
4
import logging
5
6
from vigigraph.config.environment import load_environment
7 029ee76e Thomas BURGUIERE
from vigilo.turbogears import populate_db 
8 0931fc44 Thomas BURGUIERE
9
__all__ = ['setup_app']
10
11
log = logging.getLogger(__name__)
12
13
14 98c1bcf7 Thomas BURGUIERE
def setup_app(command, conf, variables):
15 0931fc44 Thomas BURGUIERE
    """Place any commands to setup vigigraph here"""
16
    load_environment(conf.global_conf, conf.local_conf)
17 029ee76e Thomas BURGUIERE
    populate_db()
18 98c1bcf7 Thomas BURGUIERE
19 43e9f440 Francois POIROTTE
def init_db():
20
    """
21
    Cette fonction est appelée par le script vigigraph-init-db
22
    pour initialiser la base de données de VigiGraph.
23
    """
24
    from paste.script.appinstall import SetupCommand
25
    import os.path
26
27 87cf652b Francois POIROTTE
    ini_file = os.getenv("VIGILO_SETTINGS",
28
                         "/etc/vigilo/vigigraph/settings.ini")
29 43e9f440 Francois POIROTTE
30
    cmd = SetupCommand('setup-app')
31
    cmd.run([ini_file])