Answer the question
In order to leave comments, you need to log in
Is there an option to completely close the connection to mysql?
SQLAlchemy constantly maintains a connection to the database.
Is there any way to make the connection close after the application is executed?
I tried to do like this:
@app.teardown_appcontext
def shutdown_db(exception=None):
db.session.remove()
db.session.close()
python 6508 myflask 8u IPv4 495690 0t0 TCP localhost:36322->localhost:mysql (ESTABLISHED)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question