forked from qiangitchen/tlv8-python-flask
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
35 lines (26 loc) · 885 Bytes
/
config.py
File metadata and controls
35 lines (26 loc) · 885 Bytes
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
# -*- coding=utf-8 -*-
import os
class Config:
SECRET_KEY = 'tlv8-flask'
SQLALCHEMY_TRACK_MODIFICATIONS = True
UP_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "uploads") # 文件上传路径
MAX_CONTENT_LENGTH = 100 * 1024 * 1024 # 上传文件限制为最大 100 MB
@staticmethod
def init_app(app):
f = open('app/banner.txt', 'r')
file_contents = f.read()
print(file_contents)
f.close()
# the config for development
class DevelopmentConfig(Config):
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:TLv8MySQL@127.0.0.1:3306/tlv8'
DEBUG = True
# 生产环境
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:TLv8MySQL@127.0.0.1:3306/tlv8'
DEBUG = False
# define the config
config = {
'default': DevelopmentConfig,
'production': ProductionConfig
}