Blame view

pdc_config.py 1.5 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
13
    SECRET_KEY = 'dev'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
d086fdc1   hitier   Main config file ...
14
15
16
17
18
19
20

    # 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...
21

2d4a51a9   hitier   gitignore
22
23
24
25
26
27
28
29
30
31
32
    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 ...
33
34
35
36
37
38
    # 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')
2d4a51a9   hitier   gitignore
39
40
41
42
43


class TestConfig(Config):
    TESTING = True
    DEBUG = True
d086fdc1   hitier   Main config file ...
44
45
46
47
48
49
    # 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
50
51
52
    # ignores @login_required decorator
    # LOGIN_DISABLED = True

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