forked from Key20/dts_test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
59 lines (45 loc) · 1.75 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
# coding=utf-8
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.com.com'
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USERNAME = 'username'
MAIL_PASSWORD = 'password'
FLASKY_MAIL_SUBJECT_PREFIX = '[DTS]'
FLASKY_MAIL_SENDER = 'DTS Admin <username@com.com>'
FLASKY_ADMIN = os.environ.get('FLASKY_ADMIN')
FLASKY_POSTS_PER_PAGE = 25
FLASKY_FOLLOWERS_PER_PAGE = 50
FLASKY_COMMENTS_PER_PAGE = 30
UPLOAD_FOLDER = os.path.join(basedir, 'app/attachment_files')
# 附件存放目录和附件大小控制
UPLOAD_FOLDER = basedir + '/app/attachments_files/'
MAX_CONTENT_LENGTH = 16 * 1024 * 1024
# 临时存放数据导出文件
OUTPUT_FOLDER = basedir + '/app/output_files/'
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DEV_DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
'sqlite:///' + os.path.join(basedir, 'data-test.sqlite')
class ProductionConfig(Config):
#SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
# 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
SQLALCHEMY_DATABASE_URI = "mysql://dts:140327@172.16.110.1:3306/dts"
#SQLALCHEMY_ECHO = True
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}