How to implement threading with flask on heroku [duplicate]
问题 This question already has an answer here : Flask Gunicorn app can't get __name__ to equal '__main__' (1 answer) Closed 3 months ago . I have the following code for testing running two threads with flask on heroku. app.py from flask import Flask, render_template import threading import time import sys app = Flask(__name__, static_url_path='') test_result = 'failed' @app.route('/') def index(): return 'Hello! Server is running' @app.route('/thread-test') def thread_test(): global test_result