I've been looking into microframeworks for Python, and have come across two interesting options, Flask and Bottle. each have some similar features. One thing I noticed is that all the example sites show all the application code located inside a single Python file. Obviously, for even moderately sized sites, this would become difficult to manage quite quickly. Do either (or both) of these frameworks support being broken up among different files, and if so how would that be accomplished?
I'm familiar with Django, and like how its a little more structured, but i would rather use something more lightweight, but still powerful.
I don't have any experience with Bottle, but take a look at the Flask docs on larger applications. My Flask apps all use multiple Flask Module
objects as that page recommends, one per Python module, and it seems to work just fine.
One thing that's nice about the Module
objects is that you can customize dispatch on each one to create URL routing "domains" in your app. So for example, I'm trying to ape a Windows app in some of my code so I have a CaseInsensitiveModule
that does case-insensitive dispatch, and I rigged up a RemoteModule
to turn HTTP requests into Python methods using the Flask/Werkzeug routing system.
(Note that in current Flask versions, Module
s are now Blueprint
s.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With