Skip to content
Myr

Rewrote parts of the foreword and becoming big section

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 2912ff6 · Browse files · 2 files+40 added−34 removed
This commit

State

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

Diff stats

2 files+40 added−34 removed

  • other:+40 added−34 removed

2 files+40 added−34 removed

modified:docs/becomingbig.rst+24 added-12 removed
16 unmodified lines
1718Flask is designed to be extended and modified in a couple of different19ways:2021- Flask extensions. For a lot of reusable functionality you can create22 extensions. For extensions a number of hooks exist throughout Flask23 with signals and callback functions.2425- Subclassing. The majority of functionality can be changed by creating26 a new subclass of the :class:`~flask.Flask` class and overriding23 some methods.27 methods provided for this exact purpose.2825- Flask extensions. For a lot of reusable functionality you can create26 extensions.2729- Forking. If nothing else works out you can just take the Flask30 codebase at a given point and copy/paste it into your application31 and change it. Flask is designed with that in mind and makes this32 incredible easy. You just have to take the package and copy it
16 unmodified lines
49reflected in the license of Flask. You don't have to contribute any50changes back if you decide to modify the framework.5152The downside of forking is of course that Flask extensions will most52likely break because the new framework has a different import name and53because of that forking should be the last resort.53likely break because the new framework has a different import name.54Furthermore integrating upstream changes can be a complex process,55depending on the number of changes. Because of that, forking should be56the very last resort.5758Scaling like a Pro59------------------60
9 unmodified lines
70support a second server.7172There is only one limiting factor regarding scaling in Flask which are73the context local proxies. They depend on context which in Flask is71defined as being either a thread or a greenlet. Separate processes are72fine as well. If your server uses some kind of concurrency that is not73based on threads or greenlets, Flask will no longer be able to support74these global proxies. However the majority of servers are using either75threads, greenlets or separate processes to achieve concurrency which are76all methods well supported by the underlying Werkzeug library.74defined as being either a thread, process or greenlet. If your server75uses some kind of concurrency that is not based on threads or greenlets,76Flask will no longer be able to support these global proxies. However the77majority of servers are using either threads, greenlets or separate78processes to achieve concurrency which are all methods well supported by79the underlying Werkzeug library.8081Dialogue with the Community82---------------------------8384The Flask developers are very interested to keep everybody happy, so as85soon as you find an obstacle in your way, caused by Flask, don't hesitate86to contact the developers on the mailinglist or IRC channel. The best way87for the Flask and Flask-extension developers to improve it for larger88applications is getting feedback from users.
modified:docs/foreword.rst+16 added-22 removed
21 unmodified lines
22applications because changes on these thread-local objects can happen23anywhere in the same thread.2425Flask provides some tools to deal with the downsides of this approach but26it might be an issue for larger applications. Flask is also based on27convention over configuration, which means that many things are28preconfigured and will work well for smaller applications but not so well29for larger ones. For example, by convention, templates and static files30are in subdirectories within the Python source tree of the application.26it might be an issue for larger applications because in theory27modifications on these objects might happen anywhere in the same thread.2829Flask is also based on convention over configuration, which means that30many things are preconfigured. For example, by convention, templates and31static files are in subdirectories within the Python source tree of the32application.3334The main reason however why Flask is called a "microframework" is the idea35to keep the core simple but extensible. There is database abstraction36layer, no form validation or anything else where different libraries37already exist that can handle that. However Flask knows the concept of38extensions that can add this functionality into your application as if it39was implemented in Flask itself. There are currently extensions for40object relational mappers, form validation, upload handling, various open41authentication technologies and more.4243However Flask is not much code and built in a very solid foundation and44with that very easy to adapt for large applications. If you are45interested in that, check out the :ref:`becomingbig` chapter.46
32 unmodified lines
79probing for ways to fill your database with spam, links to malicious80software, and the like.8182So always keep security in mind when doing web development.7273Target Audience74---------------7576Is Flask for you? If your application is small or medium sized and does77not depend on very complex database structures, Flask is the Framework for78you. It was designed from the ground up to be easy to use, and built on79the firm foundation of established principles, good intentions, and80mature, widely used libraries. Recent versions of Flask scale nicely81within reasonable bounds, and if you grow larger, you won't have any82trouble adjusting Flask for your new application size.8384If you suddenly discover that your application grows larger than85originally intended, head over to the :ref:`becomingbig` section to see86some possible solutions for larger applications.8788Satisfied? Then let's proceed with :ref:`installation`.