-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
68 lines (51 loc) · 1.96 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
59
60
61
62
63
64
65
66
67
68
import os
import redis
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(basedir, ".env"))
class Config(object):
SECRET_KEY = os.environ.get("SECRET_KEY") or "123456"
DEBUG = os.environ.get("DEBUG") or True
FLASK_ENV = os.environ.get("FLASK_ENV") or "development"
LOGGING_LEVEL = os.environ.get("LOGGING_LEVEL") or "DEBUG"
TIMEZONE = os.environ.get(
"TIMEZONE"
) or 'Europe/London'
SQLALCHEMY_DATABASE_URI = os.environ.get(
"SQLALCHEMY_DATABASE_URI"
) or "sqlite:///" + os.path.join(basedir, "project.db")
SQLALCHEMY_TRACK_MODIFICATIONS = False
SESSION_COOKIE_SECURE = os.environ.get("SESSION_COOKIE_SECURE") or False
REMEMBER_COOKIE_SECURE = os.environ.get("REMEMBER_COOKIE_SECURE") or False
SESSION_COOKIE_HTTPONLY = os.environ.get(
"SESSION_COOKIE_HTTPONLY"
) or False
REMEMBER_COOKIE_HTTPONLY = os.environ.get(
"REMEMBER_COOKIE_HTTPONLY"
) or False
UPLOADED_PHOTOS_DEST = os.path.join(basedir, "app/static/uploads")
UPLOADED_FILES_ALLOW = ["jpg", "png"]
DEMO_MODE = os.environ.get("DEMO_MODE") or True
CELERY_BROKER_URL = os.environ.get(
"CELERY_BROKER_URL"
) or 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = os.environ.get(
"CELERY_RESULT_BACKEND"
) or 'redis://localhost:6379/0'
CELERY_CONFIG = {
"broker_url": os.environ.get(
"CELERY_BROKER_URL"
),
"result_backend": os.environ.get(
"CELERY_RESULT_BACKEND"
),
"timezone": TIMEZONE,
"imports": (
'app.watering',
),
}
SESSION_TYPE = os.environ.get("SESSION_TYPE") or 'filesystem'
SESSION_PERMANENT = os.environ.get("SESSION_PERMANENT") or False
SESSION_USE_SIGNER = os.environ.get("SESSION_USE_SIGNER") or True
if SESSION_TYPE == "redis":
SESSION_REDIS = redis.from_url(os.environ.get("SESSION_REDIS"))