-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
57 lines (43 loc) · 1.77 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'changxin'
__mtime__ = '2021/5/31'
"""
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = True
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess key'
SQLALCHEMY_RECORD_QUERIES = True
FLASKY_DB_QUERY_TIMEOUT = 0.5
REDIS_HOST = "127.0.0.1" # redis数据库地址
REDIS_PORT = 6379 # redis 端口号
REDIS_DB = 0 # 数据库名
REDIS_EXPIRE = 60 # redis 过期时间60秒
UPLOAD_PATH = os.path.join(basedir, "upload")
UPLOAD_ALGORITHM_PATH = os.path.join(basedir, "upload_algorithm")
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get(
'TEST_DATABASE_URL') or 'mysql+pymysql://root:Aizai2017.@localhost:3306/data_credit?charset=utf8mb4'
# SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///' + os.path.join(basedir,
# 'test-data-dev.sqlite')
class TestingConfig(Config):
TESTING = True
WTF_CSRF_ENABLED = False
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or 'sqlite:///' + os.path.join(basedir,
'test-data-dev.sqlite')
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = os.environ.get(
'TEST_DATABASE_URL') or 'mysql+pymysql://root:p@ssw0rd1@localhost:3306/data_credit?charset=utf8mb4'
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}