Copy edited and partially rewrote the foreword.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Matt Campbell · committed by Armin Ronacher · parent 14fde07 · Browse files · 2 files·+52 added−52 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+52 added−52 removed
- other:+52 added−52 removed
Provenance
- Commit
f3dd3da- Tree
3ba4871- Author
Matt Campbell <mattcampbell@pobox.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
14fde07
2 files changed+52 added−52 removed
modified:docs/contents.rst.inc+3 added-3 removed
1 User's Guide2 ------------3 4-This part of the documentation is written text and should give you an idea5-how to work with Flask. It's a series of step-by-step instructions for6-web development.4+This part of the documentation, which is mostly prose, begins with some5+background information about Flask, then focuses on step-by-step6+instructions for web development with Flask.7 8 .. toctree::9 :maxdepth: 210 39 unmodified linesmodified:docs/foreword.rst+49 added-49 removed
1 Foreword2 ========3 4 Read this before you get started with Flask. This hopefully answers some5-questions about the intention of the project, what it aims at and when you5+questions about the purpose and goals of the project, and when you6 should or should not be using it.7 8-What does Micro Mean?9----------------------8+What does "micro" mean?9+-----------------------10 11-The micro in microframework for me means on the one hand being small in12-size and complexity but on the other hand also that the complexity of the13-applications that are written with these frameworks do not exceed a14-certain size. A microframework like Flask sacrifices a few things in15-order to be approachable and to be as concise as possible.11+To me, the "micro" in microframework refers not only to the simplicity and12+small size of the framework, but also to the typically limited complexity13+and size of applications that are written with the framework. To be14+approachable and concise, a microframework sacrifices a few features that15+may be necessary in larger or more complex applications.16 17-For example Flask uses thread local objects internally so that you don't17+For example, Flask uses thread-local objects internally so that you don't18 have to pass objects around from function to function within a request in19 order to stay threadsafe. While this is a really easy approach and saves20 you a lot of time, it also does not scale well to large applications.21-It's especially painful for more complex unittests and when you suddenly22-have to deal with code being executed outside of the context of a request23-(for example if you have cronjobs).21+It's especially painful for more complex unittests, and when you suddenly22+have to deal with code being executed outside of the context of a request,23+such as in cron jobs.24 25-Flask provides some tools to deal with the downsides of this approach but26-the core problem of this approach obviously stays. It is also based on27-convention over configuration which means that a lot of things are28-preconfigured in Flask and will work well for smaller applications but not29-so much for larger ones (where and how it looks for templates, static30-files etc.)25+Flask provides some tools to deal with the downsides of this approach, but26+the core problem remains. Flask is also based on convention over27+configuration, which means that many things are preconfigured and will28+work well for smaller applications but not so well for larger ones. For29+example, by convention, templates and static files are in subdirectories30+within the Python source tree of the application.31 32-But don't worry if your application suddenly grows larger than it was33-initially and you're afraid Flask might not grow with it. Even with34-larger frameworks you sooner or later will find out that you need32+But don't worry if your application suddenly grows larger33+and you're afraid Flask might not grow with it. Even with34+larger frameworks, you'll eventually discover that you need35 something the framework just cannot do for you without modification.36 If you are ever in that situation, check out the :ref:`becomingbig`37 chapter.38 39-A Framework and An Example39+A Framework and an Example40 --------------------------41 42-Flask is not only a microframework, it is also an example. Based on42+Flask is not only a microframework; it is also an example. Based on43 Flask, there will be a series of blog posts that explain how to create a44 framework. Flask itself is just one way to implement a framework on top45-of existing libraries. Unlike many other microframeworks Flask does not46-try to implement anything on its own, it reuses existing code.45+of existing libraries. Unlike many other microframeworks, Flask does not46+try to implement everything on its own; it reuses existing code.47 48 Web Development is Dangerous49 ----------------------------50 51-I'm not even joking. Well, maybe a little. If you write a web52-application you are probably allowing users to register and leave their51+I'm not joking. Well, maybe a little. If you write a web52+application, you are probably allowing users to register and leave their53 data on your server. The users are entrusting you with data. And even if54 you are the only user that might leave data in your application, you still55-want that data to be stored in a secure manner.55+want that data to be stored securely.56 57-Unfortunately there are many ways security of a web application can be57+Unfortunately, there are many ways the security of a web application can be58 compromised. Flask protects you against one of the most common security59-problems of modern web applications: cross site scripting (XSS). Unless60-you deliberately mark insecure HTML as secure Flask (and the underlying61-Jinja2 template engine) have you covered. But there are many more ways to59+problems of modern web applications: cross-site scripting (XSS). Unless60+you deliberately mark insecure HTML as secure, Flask and the underlying61+Jinja2 template engine have you covered. But there are many more ways to62 cause security problems.63 64-Whenever something is dangerous where you have to watch out, the65-documentation will tell you so. Some of the security concerns of web66-development are far more complex than one might think and often we all end67-up in situations where we think "well, this is just far fetched, how could68-that possibly be exploited" and then an intelligent guy comes along and69-figures a way out to exploit that application. And don't think, your70-application is not important enough for hackers to take notice. Depending71-on the kind of attack, chances are there are automated botnets out there72-trying to figure out how to fill your database with viagra advertisements.64+The documentation will warn you about aspects of web development that65+require attention to security. Some of these security concerns66+are far more complex than one might think, and we all sometimes underestimate67+the likelihood that a vulnerability will be exploited, until a clever68+attacker figures out a way to exploit our applications. And don't think69+that your application is not important enough to attract an attacker.70+Depending on the kind of attack, chances are that automated bots are71+probing for ways to fill your database with spam, links to malicious72+software, and the like.73 74-So always keep that in mind when doing web development.74+So always keep security in mind when doing web development.75 76 Target Audience77 ---------------78 79-Is Flask for you? If your application small-ish and does not depend on80-too complex database structures, Flask is the Framework for you. It was81-designed from the ground up to be easy to use, based on established82-principles, good intentions and on top of two established libraries in83-widespread usage. Recent versions of Flask scale nicely within reasonable84-bounds and if you grow larger, you won't have any troubles adjusting Flask79+Is Flask for you? If your application is small-ish and does not depend on80+very complex database structures, Flask is the Framework for you. It was81+designed from the ground up to be easy to use, and built on the firm82+foundation of established principles, good intentions, and mature, widely83+used libraries. Recent versions of Flask scale nicely within reasonable84+bounds, and if you grow larger, you won't have any trouble adjusting Flask85 for your new application size.86 87 If you suddenly discover that your application grows larger than88 originally intended, head over to the :ref:`becomingbig` section to see89 some possible solutions for larger applications.90 91-Satisfied? Then head over to the :ref:`installation`.91+Satisfied? Then let's proceed with :ref:`installation`.