Thread that calls function in a HTTP request throws RuntimeError: Working outside of application context
问题 I have route within my Flask application that process a POST request and then sends an email to the client using the Flask-Mail library. I have the route returning a response to the client from checking the database before sending out an email. The email is sent from an individual thread, but I am getting this error thrown when trying to send out the email: RuntimeError: Working outside of application context. . I know that it is being thrown because the request was destroyed before the