pdc_config.py
2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
from db_config import *
root_dir = os.path.abspath(os.path.dirname(__file__))
#
# SQLALCHEMY_DATABASE_URI will default to 'sqlite:///:memory:' if not set
#
class Config(object):
SECRET_KEY = 'dev'
SQLALCHEMY_TRACK_MODIFICATIONS = False
# 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
# 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')
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')
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
# 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')
class TestConfig(Config):
TESTING = True
DEBUG = True
# 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')
# ignores @login_required decorator
# LOGIN_DISABLED = True
# vim: tw=0