Skip to content

app.exception_handler does not work when used in separate file #1191

Closed Answered by michaelbrewer
arunbhati asked this question in Q&A
Discussion options

You must be logged in to vote

@arunbhati in your example nothing is referencing exceptions.py so it would not call either of the @app.exception_handler or @app.not_found decorators.

You can verify that exceptions.py is not being referenced by adding a print statement.

So maybe either reference the exceptions.py as an import elsewhere or load it via __init__.py, or move the logic in __init__.py__

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by heitorlessa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants