Closed muyueyue closed 5 years ago
Same problem here...
Solution for Flask: pass use_reloader=False
to app.run
hence:
app.run(use_reloader=False)
Cheers 😄
Small additional comment -- I'm not sure if this is something Flask-, or my-project-specific (probably the former), but for line_profiler to work properly, your view function definitions should be in the following form:
@app.route("/")
@profile
def index():
i.e., the @profile
decorator should be "within" the @app.route
one, not the other way around.
@gregsadetsky Thank you for your reply. The reason for my error is run Flask in the debug mode, as follows: app.run(host='0.0.0.0', port=5000, debug=True) When I remove 'debug=True' the error disappeared.
Not line-profiler related.
Hi,I add @profile on a function in Flask project. When I started the Flask project, always occur error as follows: NameError: name 'profile' is not defined How should I solve it?