Fixed linebreaks.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Max · committed by Max · parent 74a72e8 · Browse files · 1 file·+77 added−73 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+77 added−73 removed
- other:+77 added−73 removed
Provenance
- Commit
d8c2ec4- Tree
06f4d59- Author
Max <garbados@gmail.com>- Committer
Max <garbados@gmail.com>- Parent
74a72e8
1 file changed+77 added−73 removed
modified:docs/foreword.rst+77 added-73 removed
1-Foreword1+Foreword 2 ========3 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.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.7 8-What does "micro" mean?8+What does "micro" mean? 9 -----------------------10 11-As Flask considers it, the "micro" in microframework refers not only to the simplicity and12-small size of the framework, but also the fact that it does not make many13-decisions for you. While Flask does pick a templating engine for you, we14-won't make such decisions for your datastore or other parts.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.16 16-However, to us the term “micro” does not mean that the whole implementation17-has to fit into a single Python file.17+However, to us the term “micro” does not mean that the whole18+implementation has to fit into a single Python file.19 20 One of the design decisions with Flask was that simple tasks should be20-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.21+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.32 33 Flask is also based on convention over configuration, which means that33-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.34+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.38 37-The main reason Flask is called a "microframework" is the idea38-to keep the core simple but extensible. There is no database abstraction39+The main reason Flask is called a "microframework" is the idea to keep40+the core simple but extensible. There is no database abstraction41 layer, no form validation or anything else where different libraries40-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.42+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.47 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.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.54 55 If you are curious about the Flask design principles, head over to the56 section about :ref:`design`.57 55-Web Development is Dangerous56-----------------------------58+Web Development is Dangerous ----------------------------59 58-If you write a web59-application, you are probably allowing users to register and leave their60-data on your server. The users are entrusting you with data. And even if61-you are the only user that might leave data in your application, you still62-want that data to be stored securely.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.65 64-Unfortunately, there are many ways the security of a web application can be65-compromised. Flask protects you against one of the most common security66-problems of modern web applications: cross-site scripting (XSS). Unless67-you deliberately mark insecure HTML as secure, Flask and the underlying68-Jinja2 template engine have you covered. But there are many more ways to69-cause security problems.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.72 73 The documentation will warn you about aspects of web development that72-require attention to security. Some of these security concerns73-are far more complex than one might think, and we all sometimes underestimate74-the likelihood that a vulnerability will be exploited - until a clever75-attacker figures out a way to exploit our applications. And don't think76-that your application is not important enough to attract an attacker.77-Depending on the kind of attack, chances are that automated bots are78-probing for ways to fill your database with spam, links to malicious79-software, and the like.74+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.82 83 So always keep security in mind when doing web development.84 83-The Status of Python 385+The Status of Python 3 86 ----------------------87 86-Currently the Python community is in the process of improving libraries to87-support the new iteration of the Python programming language. While the88-situation is greatly improving there are still some issues that make it89-hard for us to switch over to Python 3 just now. These problems are90-partially caused by changes in the language that went unreviewed for too91-long, partially also because we have not quite worked out how the lower-92-level API should change to account for the Unicode differences in Python 3.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.96 94-Werkzeug and Flask will be ported to Python 3 as soon as a solution for95-the changes is found, and we will provide helpful tips how to upgrade96-existing applications to Python 3. Until then, we strongly recommend97-using Python 2.6 and 2.7 with activated Python 3 warnings during98-development. If you plan on upgrading to Python 3 in the near future we99-strongly recommend that you read `How to write forwards compatible100-Python code <http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/>`_.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/>`_.