-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
config.py
41 lines (31 loc) · 1.08 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
"""App configuration."""
import subprocess
from os import environ, path
import redis
from dotenv import load_dotenv
# Read environment variables from ".env" file.
BASE_DIR = path.abspath(path.dirname(__file__))
load_dotenv(path.join(BASE_DIR, ".env"))
class Config:
"""Set Flask configuration variables from .env file."""
# General Config
ENVIRONMENT = environ.get("ENVIRONMENT")
# Flask Config
FLASK_APP = "main.py"
FLASK_DEBUG = environ.get("FLASK_DEBUG")
SECRET_KEY = environ.get("SECRET_KEY")
# Flask-Session
REDIS_URI = environ.get("REDIS_URI")
SESSION_TYPE = "redis"
SESSION_REDIS = redis.from_url(REDIS_URI)
# Flask-SQLAlchemy
SQLALCHEMY_DATABASE_URI = environ.get("SQLALCHEMY_DATABASE_URI")
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = False
# Flask-Assets (Optional)
LESS_BIN = subprocess.run("which lessc", shell=True, check=True)
ASSETS_DEBUG = False
LESS_RUN_IN_DEBUG = False
STATIC_FOLDER = "static"
TEMPLATES_FOLDER = "templates"
COMPRESSOR_DEBUG = environ.get("COMPRESSOR_DEBUG")