Blame view

resources/pdc_config.py 3.15 KB
2d4a51a9   hitier   gitignore
1
import os
d086fdc1   hitier   Main config file ...
2
from db_config import *
2d4a51a9   hitier   gitignore
3
4
5
6

root_dir = os.path.abspath(os.path.dirname(__file__))


d086fdc1   hitier   Main config file ...
7
8
9
10
#
# SQLALCHEMY_DATABASE_URI will default to 'sqlite:///:memory:' if not set
#

2d4a51a9   hitier   gitignore
11
class Config(object):
2795e037   hitier   Update configurat...
12
    SECRET_KEY = 'dev'
d086fdc1   hitier   Main config file ...
13

f18213fd   hitier   New PDC_SITE_CLAS...
14
15
    # Please change the following to fit you own site parameters
    #
880e8a55   hitier   New config vars u...
16
17
    PDC_APP_NAME = 'Plan de Charge'
    PDC_SITE_NAME = 'NO_SITE'  # choose among IRAP, PUBLIC, ...
f18213fd   hitier   New PDC_SITE_CLAS...
18
    PDC_SITE_CLASS = 'public-icon'  # choose among admin-icon, public-icon
9b19aa41   hitier   fix default confi...
19
    PDC_LOGS_LEVEL = 'DEBUG'  # choose within  DEBUG, INFO, WARN, ERROR ( more levels in logging module )
880e8a55   hitier   New config vars u...
20
    PDC_LOGS_DIR = os.path.join(root_dir, 'logs')
9b19aa41   hitier   fix default confi...
21
    PDC_LOGS_FILE = os.path.join(PDC_LOGS_DIR, 'pdc.log')
880e8a55   hitier   New config vars u...
22

3b0d5feb   hitier   New Site_Login ca...
23
24
25
26
27
28
29
30
31
32
33
    # Uncomment for role access control
    #   if True, will disable any role control on routes
    #   note that this doesnt disable the @login_required
    #
    # ROLE_DISABLED = False

    # Uncomment for site access control
    #   if True, will force login access on any site page 
    #   note that this doesnt disable the @login_required 
    #
    # SITE_LOGIN = False
08d06308   hitier   New ROLE_DISABLED...
34

f18213fd   hitier   New PDC_SITE_CLAS...
35
36
37
38
    #
    # No need to Edit below
    #

7e08aa0c   hitier   Allow force loggi...
39
40
41
42
43
44
    # You can force logging to stdout in production environment
    # (make sure your httpd/wsgi server can redirect to log files)
    LOG_TO_STDOUT = os.environ.get('LOG_TO_STDOUT')
    if LOG_TO_STDOUT and LOG_TO_STDOUT.upper() == "true".upper():
        LOG_TO_STDOUT = True

9b19aa41   hitier   fix default confi...
45
46
    SQLALCHEMY_TRACK_MODIFICATIONS = False

d086fdc1   hitier   Main config file ...
47
48
49
50
51
52
    # Trying to set specific db uri from ./db_config.py
    try:
        SQLALCHEMY_DATABASE_URI = sqlalchemy_database_uri
    except NameError:
        SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
                                  'sqlite:///' + os.path.join(root_dir, 'pdc_app.db')
2795e037   hitier   Update configurat...
53

21724174   hitier   Fix mysql_lesia_u...
54
55
56
57
58
59
    try:
        LESIA_AGENTS_DB_URI = mysql_lesia_uri
    except NameError:
        LESIA_AGENTS_DB_URI = os.environ.get('LESIA_AGENTS_DB_URI') or \
                              'sqlite:///' + os.path.join(root_dir, 'lesia.db')

2d4a51a9   hitier   gitignore
60
61
62
63
64
65
66
67
68
69
70
    with open(os.path.join(root_dir, 'VERSION.txt')) as version_file:
        VERSION = version_file.read().strip()


class ProdConfig(Config):
    TESTING = False
    DEBUG = False


class DevConfig(Config):
    DEBUG = True
d086fdc1   hitier   Main config file ...
71
72
73
74
75
76
    # Trying to set specific db uri from ./db_config.py
    try:
        SQLALCHEMY_DATABASE_URI = sqlalchemy_devdb_uri
    except NameError:
        SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
                                  'sqlite:///' + os.path.join(root_dir, 'pdc_app_dev.db')
08d06308   hitier   New ROLE_DISABLED...
77
78
79
80
    # ignores @login_required decorator
    LOGIN_DISABLED = True
    # ignores @role_required decorator
    ROLE_DISABLED = True
2d4a51a9   hitier   gitignore
81
82
83
84
85


class TestConfig(Config):
    TESTING = True
    DEBUG = True
08d06308   hitier   New ROLE_DISABLED...
86
    PDC_LOGS_LEVEL = 'ERROR'  # choose within  DEBUG, INFO, WARN, ERROR ( more levels in logging module )
d086fdc1   hitier   Main config file ...
87
88
89
90
91
92
    # Trying to set specific db uri from ./db_config.py
    try:
        SQLALCHEMY_DATABASE_URI = sqlalchemy_testdb_uri
    except NameError:
        SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
                                  'sqlite:///' + os.path.join(root_dir, 'pdc_app_test.db')
2d4a51a9   hitier   gitignore
93
    # ignores @login_required decorator
08d06308   hitier   New ROLE_DISABLED...
94
95
96
    LOGIN_DISABLED = True
    # ignores @role_required decorator
    ROLE_DISABLED = True
2d4a51a9   hitier   gitignore
97

2795e037   hitier   Update configurat...
98
# vim: tw=0