Issue
I can't seem to get Flask
to migrate my models. I'm following along with the Flask Mega-Tutorial series. At the database setup part of the tutorial, I'm just trying to substitute MySQL
for SQLite
that is used in the tutorial.
I followed SQLAlchemy
's instructions for connecting to a MySQL
database, and I've included mysqlclient
in my pipfile.
But when I run:
flask db init
flask db migrate
I get the following:
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
ERROR [root] Error: Can't locate revision identified by '7bb962b87f19'
I've tried deleting the migrations folder, and I've deleted the environment and recreated to see if that would fix anything. But it keeps saying it can't locate revision
. I thought maybe it did something with the database, I've read other solutions saying you have to flush the database. But, there aren't any tables created or any schemas in the database.
Other info:
DATABASE_URL="mysql://root:mypassword@localhost/flask_tutorial"
SQLite
database runs fine and makes the migrations. So it must be something I've done with the mysql setup.
Any suggestions or ideas that may lead me in the right direction would be greatly appreciated.
Solution
The session was storing incorrect environmental variables exported. Had to completely restart my machine for the settings to reset. I even tried unset
for the variables, which didn't remove the variables. Once Flask was able to pick up the correct variable settings for my configuration everything worked as planned.
Answered By - Corey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.