[Flask] Help with converters that require an application context
Alexei Bendebury
alexeibendebury at gmail.com
Mon Aug 22 21:53:57 EDT 2016
Hello all,
I'm working on a project in which I have a lot of views that take in
an ID number of some model via url variables and then check if the
model exists before continuing.
I thought that it would be useful to move this functionality into a
url converter to clean up my code.
However, it seems that I need an application context to do a database
lookup in a url converter, and I can't quite figure out how to do it.
This SO question isn't mine, but it perfectly describes my issue,
along with code examples:
https://stackoverflow.com/questions/33856007/passing-application-context-to-custom-converter-using-the-application-factory-pa
I'd appreciate any suggestions on what to do.
More information about the Flask
mailing list