Skip to content
Myr

remove becomingbig.rst

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

authored by Luis Palacios · committed by David Lord · parent 587a49c · Browse files · 5 files+4 added−112 removed
This commit

State

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

Diff stats

5 files+4 added−112 removed

  • other:+4 added−112 removed

5 files+4 added−112 removed

modified:docs/patterns/packages.rst-4 removed
171 unmodified lines
172 that we are not actually using the views in :file:`__init__.py` and just173 ensuring the module is imported and we are doing that at the bottom of174 the file.175176 There are still some problems with that approach but if you want to use177 decorators there is no way around that. Check out the178 :doc:`/becomingbig` section for some inspiration how to deal with that.176180177Working with Blueprints178-----------------------179180If you have larger applications it's recommended to divide them into
3 unmodified lines
deleted:docs/becomingbig.rst-100 removed
1Becoming Big2============34Here are your options when growing your codebase or scaling your application.56Read the Source.7----------------89Flask started in part to demonstrate how to build your own framework on top of10existing well-used tools Werkzeug (WSGI) and Jinja (templating), and as it11developed, it became useful to a wide audience. As you grow your codebase,12don't just use Flask -- understand it. Read the source. Flask's code is13written to be read; its documentation is published so you can use its internal14APIs. Flask sticks to documented APIs in upstream libraries, and documents its15internal utilities so that you can find the hook points needed for your16project.1718Hook. Extend.19-------------2021The :doc:`/api` docs are full of available overrides, hook points, and22:doc:`/signals`. You can provide custom classes for things like the23request and response objects. Dig deeper on the APIs you use, and look24for the customizations which are available out of the box in a Flask25release. Look for ways in which your project can be refactored into a26collection of utilities and Flask extensions. Explore the many27:doc:`/extensions` in the community, and look for patterns to build your28own extensions if you do not find the tools you need.2930Subclass.31---------3233The :class:`~flask.Flask` class has many methods designed for subclassing. You34can quickly add or customize behavior by subclassing :class:`~flask.Flask` (see35the linked method docs) and using that subclass wherever you instantiate an36application class. This works well with :doc:`/patterns/appfactories`.37See :doc:`/patterns/subclassing` for an example.3839Wrap with middleware.40---------------------4142The :doc:`/patterns/appdispatch` pattern shows in detail how to apply middleware. You43can introduce WSGI middleware to wrap your Flask instances and introduce fixes44and changes at the layer between your Flask application and your HTTP45server. Werkzeug includes several `middlewares46<https://werkzeug.palletsprojects.com/middleware/>`_.4748Fork.49-----5051If none of the above options work, fork Flask. The majority of code of Flask52is within Werkzeug and Jinja2. These libraries do the majority of the work.53Flask is just the paste that glues those together. For every project there is54the point where the underlying framework gets in the way (due to assumptions55the original developers had). This is natural because if this would not be the56case, the framework would be a very complex system to begin with which causes a57steep learning curve and a lot of user frustration.5859This is not unique to Flask. Many people use patched and modified60versions of their framework to counter shortcomings. This idea is also61reflected in the license of Flask. You don't have to contribute any62changes back if you decide to modify the framework.6364The downside of forking is of course that Flask extensions will most65likely break because the new framework has a different import name.66Furthermore integrating upstream changes can be a complex process,67depending on the number of changes. Because of that, forking should be68the very last resort.6970Scale like a pro.71-----------------7273For many web applications the complexity of the code is less an issue than74the scaling for the number of users or data entries expected. Flask by75itself is only limited in terms of scaling by your application code, the76data store you want to use and the Python implementation and webserver you77are running on.7879Scaling well means for example that if you double the amount of servers80you get about twice the performance. Scaling bad means that if you add a81new server the application won't perform any better or would not even82support a second server.8384There is only one limiting factor regarding scaling in Flask which are85the context local proxies. They depend on context which in Flask is86defined as being either a thread, process or greenlet. If your server87uses some kind of concurrency that is not based on threads or greenlets,88Flask will no longer be able to support these global proxies. However the89majority of servers are using either threads, greenlets or separate90processes to achieve concurrency which are all methods well supported by91the underlying Werkzeug library.9293Discuss with the community.94---------------------------9596The Flask developers keep the framework accessible to users with codebases big97and small. If you find an obstacle in your way, caused by Flask, don't hesitate98to contact the developers on the mailing list or Discord server. The best way for99the Flask and Flask extension developers to improve the tools for larger100applications is getting feedback from users.
modified:docs/design.rst-3 removed
165 unmodified lines
166large applications harder to maintain. However Flask is just not designed167for large applications or asynchronous servers. Flask wants to make it168quick and easy to write a traditional web application.169170Also see the :doc:`/becomingbig` section of the documentation for some171inspiration for larger applications based on Flask.170173171Async/await and ASGI support172----------------------------173174Flask supports ``async`` coroutines for view functions by executing the
31 unmodified lines
modified:docs/foreword.rst+4 added-4 removed
45 unmodified lines
46SQLAlchemy or another database tool, introduce non-relational data persistence47as appropriate, and take advantage of framework-agnostic tools built for WSGI,48the Python web interface.4950Flask includes many hooks to customize its behavior. Should you need more51customization, the Flask class is built for subclassing. If you are interested52in that, check out the :doc:`becomingbig` chapter. If you are curious about53the Flask design principles, head over to the section about :doc:`design`.50Flask includes many hooks to customize its behavior. Should you need51more customization, the Flask class is built for subclassing. If you are52curious about the Flask design principles, head over to the section53about :doc:`design`.
modified:docs/index.rst-1 removed
56 unmodified lines
57 server58 shell59 patterns/index60 deploying/index61 becomingbig61 async-await626364API Reference
26 unmodified lines