I struggle with the same issue with a flask app. Applying the above to the main app.py of flask doesn't help. Any idea?