Dividing the application into drawings is a great idea. However, if this is not enough, and if you want to split Blueprint itself into several py files, it is also possible using the usual Python module import system, and then iterate over all the routes that are imported from other files.
I created a Gist with the code for this:
https://gist.github.com/Jaza/61f879f577bc9d06029e
As far as I know, this is the only possible way to split Blueprint at the moment. It is not possible to create βsub-drawingsβ in Flask, although the problem is open with a lot of discussion about this:
https://github.com/mitsuhiko/flask/issues/593
Also, even if it were possible (and probably could have used some fragments from this stream of problems), sub-drawings may be too restrictive for your use case anyway - for example. if you do not want all routes in the submodule to have the same URL prefix.
Jaza Feb 06 '15 at 4:08 2015-02-06 04:08
source share