2012. — 259 p. — Release 0.9-dev Другие выходные данные отсутствуют.
Flask является микрофреймворком для создания вебсайтов на языке Python.
To me, the micro in microframework refers not only to the simplicity and small size of the framework, but also the fact that it does not make many decisions for you. While Flask does pick a templating engine for you, we won’t make such decisions for your datastore or other parts.
However, to us the term micro does not mean that the whole implementation has to fit into a single Python file. One of the design decisions with Flask was that simple tasks should be simple; they should not take a lot of code and yet they should not limit you. Because of that we made a few design choices that some people might find surprising or unorthodox. For example, Flask uses thread-local objects internally so that you don’t have to pass objects around from function to function within a request in order to stay threadsafe.
While this is a really easy approach and saves you a lot of time, it might also cause some troubles for very large applications because changes on these thread-local objects can happen anywhere in the same thread. In order to solve these problems we don’t hide the thread locals for you but instead embrace them and provide you with a lot of tools to make it as pleasant as possible to work with them. Flask is also based on convention over configuration, which means that many things are preconfigured. For example, by convention templates and static files are stored in subdirectories within the application’s Python source tree. While this can be changed you usually don’t have to.
The main reason Flask is called a microframework is the idea to keep the core simple but extensible. There is no database abstraction layer, no form validation or anything else where different libraries already exist that can handle that. However Flask supports extensions to add such functionality to your application as if it was implemented in Flask itself. There are currently extensions for object-relational mappers, form validation, upload handling, various open authentication technologies and more.