AttributeError:'Engine'对象没有属性'drivername'

时间:2020-02-06 14:26:38

标签: python flask sqlalchemy flask-sqlalchemy

为Flask-SocketIO实现连接池后,我得到了此消息。我这样做是因为遇到了InterfaceError。因此,我进入了处理断开连接的文档。 [https://docs.sqlalchemy.org/en/13/core/pooling.html#pool-disconnects][1]

import os
basedir = os.path.abspath(os.path.dirname(__file__))
from sqlalchemy import create_engine

class Config(object):
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'm\x13\x96\xe2\xce/\xc8\x1b\xc4\x93@\xf4%\x19\x12\xca]\x9b\xc8\xe3;\xd5\x96='
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
    create_engine('sqlite:////' + (os.path.join(basedir, 'site.db')))
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    MAIL_SERVER = 'smtp.googlemail.com'
    MAIL_PORT = 587
    MAIL_USE_TLS = True
    MAIL_USERNAME = os.environ.get('EMAIL_USER')
    MAIL_PASSWORD = os.environ.get('EMAIL_PASS')

0 个答案:

没有答案