Skip to content
Myr

Made the foreword less defensive.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 2e4c391 · Browse files · 1 file+23 added−27 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+23 added−27 removed

  • other:+23 added−27 removed

1 file+23 added−27 removed

modified:docs/foreword.rst+23 added-27 removed
7 unmodified lines
8What does "micro" mean?9-----------------------1011To me, the "micro" in microframework refers not only to the simplicity and12small size of the framework, but also to the typically limited complexity13and size of applications that are written with the framework. Also the14fact that you can have an entire application in a single Python file. To15be approachable and concise, a microframework sacrifices a few features16that may be necessary in larger or more complex applications.12small size of the framework, but also the fact that it does not make much13decisions for you. While Flask does pick a templating engine for you, we14won't make such decisions for your datastore or other parts.1518For example, Flask uses thread-local objects internally so that you don't19have to pass objects around from function to function within a request in20order to stay threadsafe. While this is a really easy approach and saves21you a lot of time, it might also cause some troubles for very large22applications because changes on these thread-local objects can happen23anywhere in the same thread.16For us however the term “micro” does not mean that the whole implementation17has to fit into a single Python file.1825Flask provides some tools to deal with the downsides of this approach but26it might be an issue for larger applications because in theory27modifications on these objects might happen anywhere in the same thread.19One of the design decisions with Flask was that simple tasks should be20simple and not take up a lot of code and yet not limit yourself. Because21of that we took a few design choices that some people might find22surprising or unorthodox. For example, Flask uses thread-local objects23internally so that you don't have to pass objects around from function to24function within a request in order to stay threadsafe. While this is a25really easy approach and saves you a lot of time, it might also cause some26troubles for very large applications because changes on these thread-local27objects can happen anywhere in the same thread. In order to solve these28problems we don't hide the thread locals for you but instead embrace them29and provide you with a lot of tools to make it as pleasant as possible to30work with them.3132Flask is also based on convention over configuration, which means that33many things are preconfigured. For example, by convention, templates and34static files are in subdirectories within the Python source tree of the32application.35application. While this can be changed you usually don't have to.3637The main reason however why Flask is called a "microframework" is the idea38to keep the core simple but extensible. There is no database abstraction39layer, no form validation or anything else where different libraries
2 unmodified lines
42was implemented in Flask itself. There are currently extensions for43object relational mappers, form validation, upload handling, various open44authentication technologies and more.4543However Flask is not much code and it is built on a very solid foundation44and with that it is very easy to adapt for large applications. If you are45interested in that, check out the :ref:`becomingbig` chapter.46Since Flask is based on a very solid foundation there is not a lot of code47in Flask itself. As such it's easy to adapt even for lage applications48and we are making sure that you can either configure it as much as49possible by subclassing things or by forking the entire codebase. If you50are interested in that, check out the :ref:`becomingbig` chapter.5152If you are curious about the Flask design principles, head over to the53section about :ref:`design`.5450A Framework and an Example51--------------------------5253Flask is not only a microframework; it is also an example. Based on54Flask, there will be a series of blog posts that explain how to create a55framework. Flask itself is just one way to implement a framework on top56of existing libraries. Unlike many other microframeworks, Flask does not57try to implement everything on its own; it reuses existing code.5855Web Development is Dangerous56----------------------------5758I'm not joking. Well, maybe a little. If you write a web
42 unmodified lines