在config.py文件中参数名以大写形式配置
~~~
DEBUG = True#开启debug调试模式
'''数据库配置'''
DIALECT = 'mysql'
DRIVER = 'pymysql'
USERNAME = 'root'
PASSWORD = ''
HOST = '127.0.0.1'
PORT = '3306'
DATABASE = 'flask'
import os
SQLALCHEMY_DATABASE_URI = "{}+{}://{}:{}@{}:{}/{}".format(DIALECT,DRIVER,USERNAME,PASSWORD,HOST,PORT,DATABASE)
SQLALCHEMY_TRACK_MODIFICATIONS = False
UP_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'app/static/admin/uploads/')#文件上传保存路径
SECRET_KEY = '\xbf\xb0\x11\xb1\xcd\xf9\xba\x8bp\x0c...'#防csrf攻击密钥
~~~