-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigXC.py
More file actions
48 lines (38 loc) · 1.13 KB
/
configXC.py
File metadata and controls
48 lines (38 loc) · 1.13 KB
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
import logging
from redis import StrictRedis
class Config(object):
#项目的配置
DEBUG = True
SECRET_KEY = "b'q8TpYy2LUznFeGhmBro/pE9jxAUzVq9Z0dVlAYUq9vStAS64rGWLGDuzEb74LE4I'"
#为数据库添加配置
SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost:3306/information27'
SQLALCHEMY_TRACK_MODIFICATIONS = False
#redis配置
REDIS_HOST = "192.168.25.131"
REDIS_PORT = 6379
#Session保存位置
SESSION_TYPE = 'redis'
#开启session签名
SESSION_USE_SIGNER = True
#制定Session保存的 redis
SESSION_REDIS = StrictRedis(host = REDIS_HOST,port = REDIS_PORT)
#设置需要过期
SESSION_PERMAENT = False
#设置过期时间
PERMANENT_SESSION_LIFETIME = 86400*2
#设置日志等级
LOG_LEVEL = logging.DEBUG
class DevelopmentConfig(Config):
"""开发环境下的配置"""
DEBUG = True
class ProductionConfig(Config):
DEBUG = True
LOG_LEVEL = logging.WARNING
class TestingConfig(Config):
DEBUG = True
TESTING = True
config = {
"development":DevelopmentConfig,
"production":ProductionConfig,
"testing":TestingConfig
}