-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
58 lines (43 loc) · 1.63 KB
/
config.py
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
"""This module stores application configuration settings."""
import os
from datetime import timedelta
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
env_file = os.path.join(basedir, '.env')
load_dotenv(env_file)
class Config:
"""Class contains general application configuration settings.
"""
SECRET_KEY = os.environ.get("SECRET_KEY_CAR") or 'sjk897JH7KH65#(@&'
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
REMEMBER_COOKIE_DURATION = timedelta(minutes=10)
PERMANENT_SESSION_LIFETIME = timedelta(minutes=60)
CAR_ADMIN = os.environ.get('CAR_ADMIN') or 'mail@mail.com'
POSTS_PER_PAGE = 10
JWT_EXPIRED_MINUTES = 10
@staticmethod
def init_app(app):
"""Allows the application to customize its own configuration.
:param app: Flask application.
:type: class 'flask.app.Flask
"""
pass
class DevelopmentConfig(Config):
"""Class contains development configuration settings."""
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'db.sqlite')
class TestingConfig(Config):
"""Class contains test unit tests."""
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'sqlite://'
WTF_CSRF_ENABLED = False
class ProductionConfig(Config):
"""Class contains production configuration settings."""
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///'
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'testing': TestingConfig,
'default': DevelopmentConfig
}