Wrapped paragraphs; changed some words.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Max · committed by Max · parent d8c2ec4 · Browse files · 1 file·+72 added−77 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+72 added−77 removed
- other:+72 added−77 removed
Provenance
- Commit
c78070d- Tree
89a24d0- Author
Max <garbados@gmail.com>- Committer
Max <garbados@gmail.com>- Parent
d8c2ec4
1 file changed+72 added−77 removed
modified:docs/foreword.rst+72 added-77 removed
1-Foreword 1+Foreword2 ========3 4-Read this before you get started with Flask. This hopefully answers5-some questions about the purpose and goals of the project, and when6-you should or should not be using it.4+Read this before you get started with Flask. This hopefully answers some5+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? 8+What does "micro" mean?9 -----------------------10 11-As Flask considers it, the "micro" in microframework refers not only12-to the simplicity and small size of the framework, but also the fact13-that it does not make many decisions for you. While Flask does pick a14-templating engine for you, we won't make such decisions for your15-datastore or other parts.11+Flask considers the "micro" in microframework to refer not only to the12+simplicity and small size of the framework, but also to the fact that it does13+not make many decisions for you. While Flask does pick a templating engine14+for you, we won't make such decisions for your datastore or other parts.15 17-However, to us the term “micro” does not mean that the whole18-implementation has to fit into a single Python file.16+However, to us the term “micro” does not mean that the whole implementation17+has to fit into a single Python file.18 19 One of the design decisions with Flask was that simple tasks should be21-simple; they should not take a lot of code and yet they should not22-limit you. Because of that we made a few design choices that some23-people might find surprising or unorthodox. For example, Flask uses24-thread-local objects internally so that you don't have to pass objects25-around from function to function within a request in order to stay26-threadsafe. While this is a really easy approach and saves you a lot27-of time, it might also cause some troubles for very large applications28-because changes on these thread-local objects can happen anywhere in29-the same thread. In order to solve these problems we don't hide the30-thread locals for you but instead embrace them and provide you with a31-lot of tools to make it as pleasant as possible to work with them.20+simple; they should not take a lot of code and yet they should not limit you.21+Because of that we made a few design choices that some people might find22+surprising or unorthodox. For example, Flask uses thread-local objects23+internally so that you don't have to pass objects around from function to24+function within a request in order to stay threadsafe. While this is a25+really easy approach and saves you a lot of time, it might also cause some26+troubles for very large applications because changes on these thread-local27+objects can happen anywhere in the same thread. In order to solve these28+problems we don't hide the thread locals for you but instead embrace them29+and provide you with a lot of tools to make it as pleasant as possible to30+work with them.31 32 Flask is also based on convention over configuration, which means that34-many things are preconfigured. For example, by convention templates35-and static files are stored in subdirectories within the application's36-Python source tree. While this can be changed you usually don't have37-to.33+many things are preconfigured. For example, by convention templates and34+static files are stored in subdirectories within the application's Python source tree.35+While this can be changed you usually don't have to.36 39-The main reason Flask is called a "microframework" is the idea to keep40-the core simple but extensible. There is no database abstraction37+The main reason Flask is called a "microframework" is the idea38+to keep the core simple but extensible. There is no database abstraction39 layer, no form validation or anything else where different libraries42-already exist that can handle that. However Flask supports extensions43-to add such functionality to your application as if it was implemented44-in Flask itself. There are currently extensions for object-relational45-mappers, form validation, upload handling, various open authentication46-technologies and more.40+already exist that can handle that. However Flask supports41+extensions to add such functionality to your application as if it42+was implemented in Flask itself. There are currently extensions for43+object-relational mappers, form validation, upload handling, various open44+authentication technologies and more.45 48-Since Flask is based on a very solid foundation there is not a lot of49-code in Flask itself. As such it's easy to adapt even for large50-applications and we are making sure that you can either configure it51-as much as possible by subclassing things or by forking the entire52-codebase. If you are interested in that, check out the53-:ref:`becomingbig` chapter.46+Since Flask is based on a very solid foundation there is not a lot of code47+in Flask itself. As such it's easy to adapt even for large applications48+and we are making sure that you can either configure it as much as49+possible by subclassing things or by forking the entire codebase. If you50+are interested in that, check out the :ref:`becomingbig` chapter.51 52 If you are curious about the Flask design principles, head over to the53 section about :ref:`design`.54 58-Web Development is Dangerous ----------------------------55+Web Development is Dangerous56+----------------------------57 60-If you write a web application, you are probably allowing users to61-register and leave their data on your server. The users are62-entrusting you with data. And even if you are the only user that63-might leave data in your application, you still want that data to be64-stored securely.58+If you write a web application, you are probably allowing users to register59+and leave their data on your server. The users are entrusting you with data.60+And even if you are the only user that might leave data in your application,61+you still want that data to be stored securely.62 66-Unfortunately, there are many ways the security of a web application67-can be compromised. Flask protects you against one of the most common68-security problems of modern web applications: cross-site scripting69-(XSS). Unless you deliberately mark insecure HTML as secure, Flask70-and the underlying Jinja2 template engine have you covered. But there71-are many more ways to cause security problems.63+Unfortunately, there are many ways the security of a web application can be64+compromised. Flask protects you against one of the most common security65+problems of modern web applications: cross-site scripting (XSS). Unless66+you deliberately mark insecure HTML as secure, Flask and the underlying67+Jinja2 template engine have you covered. But there are many more ways to68+cause security problems.69 70 The documentation will warn you about aspects of web development that74-require attention to security. Some of these security concerns are75-far more complex than one might think, and we all sometimes76-underestimate the likelihood that a vulnerability will be exploited -77-until a clever attacker figures out a way to exploit our applications.78-And don't think that your application is not important enough to79-attract an attacker. Depending on the kind of attack, chances are that80-automated bots are probing for ways to fill your database with spam,81-links to malicious software, and the like.71+require attention to security. Some of these security concerns72+are far more complex than one might think, and we all sometimes underestimate73+the likelihood that a vulnerability will be exploited - until a clever74+attacker figures out a way to exploit our applications. And don't think75+that your application is not important enough to attract an attacker.76+Depending on the kind of attack, chances are that automated bots are77+probing for ways to fill your database with spam, links to malicious78+software, and the like.79 80 So always keep security in mind when doing web development.81 85-The Status of Python 3 82+The Status of Python 383 ----------------------84 88-Currently the Python community is in the process of improving89-libraries to support the new iteration of the Python programming90-language. While the situation is greatly improving there are still91-some issues that make it hard for us to switch over to Python 3 just92-now. These problems are partially caused by changes in the language93-that went unreviewed for too long, partially also because we have not94-quite worked out how the lower- level API should change to account for95-the Unicode differences in Python 3.85+Currently the Python community is in the process of improving libraries to86+support the new iteration of the Python programming language. While the87+situation is greatly improving there are still some issues that make it88+hard for us to switch over to Python 3 just now. These problems are89+partially caused by changes in the language that went unreviewed for too90+long, partially also because we have not quite worked out how the lower-91+level API should change to account for the Unicode differences in Python 3.92 97-Werkzeug and Flask will be ported to Python 3 as soon as a solution98-for the changes is found, and we will provide helpful tips how to99-upgrade existing applications to Python 3. Until then, we strongly100-recommend using Python 2.6 and 2.7 with activated Python 3 warnings101-during development. If you plan on upgrading to Python 3 in the near102-future we strongly recommend that you read `How to write forwards103-compatible Python code <http://lucumr.pocoo.org/2011/1/22/forwards-104-compatible-python/>`_.93+Werkzeug and Flask will be ported to Python 3 as soon as a solution for94+the changes is found, and we will provide helpful tips how to upgrade95+existing applications to Python 3. Until then, we strongly recommend96+using Python 2.6 and 2.7 with activated Python 3 warnings during97+development. If you plan on upgrading to Python 3 in the near future we98+strongly recommend that you read `How to write forwards compatible99+Python code <http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/>`_.