AttributeError: can't set attribute when running create_db.py for the first time with SQLAlchemy
travwritescode opened this issue · comments
After making all of the changes to the application in the SQLAlchemy section AND making the changes in #72 I was still getting an error:
AttributeError: can't set attribute
Sourced from the db.create_all()
function in create_db.py
.
According to this Stack Overflow question, a temporary fix for this is to downgrade the SQLAlchemy version to one lower than 1.4.0
. Use the following command: pip install 'SQLAlchemy<1.4.0'
.
All credit to user Naheed on Stack Overflow.
Note: SQLAlchemy<1.4.0
should also be added to the requirements.txt
file in order to avoid an Internal Server Error after pushing the app to Heroku.
I fixed it by updating Flask-SQLAlchemy to 2.5.1
based on pallets-eco/flask-sqlalchemy#938