Skip to content

Flask-Migrate unable to connect to MySQL in a Docker container but the Flask app works fine #514

Closed Answered by blackdwarf
blackdwarf asked this question in Q&A
Discussion options

You must be logged in to vote

Well, I feel stupid now...The solution was right in front of me, but I didn't actually read the source all the way. This commit or, rather, what it fixed, was bugging me. I generated my migrations folder way back, some years back, and the env.py file was old, which means it didn't have this new code that properly get the DB URI.

And, no, I didn't compare the code. I figured this out because I sprinkled a lot of debug statements all over the place and finally found this SO comment that made me change env.py and it worked. Then I went to write this response and saw the commit. 😢

Is there a way to regenerate the env.py file? I guess I could just move the migrations out, nuke the folder, re-run

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@blackdwarf
Comment options

@miguelgrinberg
Comment options

@blackdwarf
Comment options

Answer selected by blackdwarf
@miguelgrinberg
Comment options

@blackdwarf
Comment options

@miguelgrinberg
Comment options

@blackdwarf
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants