Sqlalchemy: 'nonetype' Object Has No Attribute 'drivername'
I'm trying to connect my flask application to my local MySQL database for testing. I've made a flask object and a class to represent an example table to be created after a successf
Solution 1:
Make sure the SQLAlchemy URI resembles this format after pip install pymysql
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://{DB_USERNAME}:{DB_PASSWORD}@localhost:3306/{DB_NAME}'
Solution 2:
if you ever use "db.Model.metadata.reflect(db.engine)" in your models.py you will still get the same error message. So change the drivername mysqldb to pymysql as suggest by @MattSom and comment or delete this instruction "db.Model.metadata.reflect(db.engine)"
Post a Comment for "Sqlalchemy: 'nonetype' Object Has No Attribute 'drivername'"