|
1 | 1 | # project/server/config.py |
2 | 2 |
|
3 | 3 | import os |
| 4 | + |
4 | 5 | basedir = os.path.abspath(os.path.dirname(__file__)) |
5 | 6 |
|
6 | 7 |
|
7 | 8 | class BaseConfig(object): |
8 | 9 | """Base configuration.""" |
9 | | - SECRET_KEY = 'my_precious' |
10 | | - BCRYPT_LOG_ROUNDS = 13 |
11 | | - WTF_CSRF_ENABLED = True |
| 10 | + BCRYPT_LOG_ROUNDS = 4 |
12 | 11 | DEBUG_TB_ENABLED = False |
13 | | - DEBUG_TB_INTERCEPT_REDIRECTS = False |
| 12 | + SECRET_KEY = os.getenv('SECRET_KEY', default='my_precious') |
14 | 13 | SQLALCHEMY_TRACK_MODIFICATIONS = False |
| 14 | + WTF_CSRF_ENABLED = False |
15 | 15 |
|
16 | 16 |
|
17 | 17 | class DevelopmentConfig(BaseConfig): |
18 | 18 | """Development configuration.""" |
19 | | - BCRYPT_LOG_ROUNDS = 4 |
20 | | - WTF_CSRF_ENABLED = False |
| 19 | + DEBUG_TB_ENABLED = True |
| 20 | + DEBUG_TB_INTERCEPT_REDIRECTS = False |
21 | 21 | SQLALCHEMY_DATABASE_URI = 'sqlite:///{0}'.format( |
22 | 22 | os.path.join(basedir, 'dev.db')) |
23 | | - DEBUG_TB_ENABLED = True |
24 | 23 |
|
25 | 24 |
|
26 | 25 | class TestingConfig(BaseConfig): |
27 | 26 | """Testing configuration.""" |
28 | | - TESTING = True |
29 | | - BCRYPT_LOG_ROUNDS = 4 |
30 | | - WTF_CSRF_ENABLED = False |
31 | | - SQLALCHEMY_DATABASE_URI = 'sqlite:///' |
32 | | - DEBUG_TB_ENABLED = False |
33 | 27 | PRESERVE_CONTEXT_ON_EXCEPTION = False |
| 28 | + SQLALCHEMY_DATABASE_URI = 'sqlite:///' |
| 29 | + TESTING = True |
34 | 30 |
|
35 | 31 |
|
36 | 32 | class ProductionConfig(BaseConfig): |
37 | 33 | """Production configuration.""" |
38 | | - SECRET_KEY = 'my_precious' |
| 34 | + BCRYPT_LOG_ROUNDS = 13 |
39 | 35 | SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/example' |
40 | | - DEBUG_TB_ENABLED = False |
| 36 | + WTF_CSRF_ENABLED = True |
0 commit comments