Skip to content
Myr

Fixed small typos in docs. Added a cross-ref.

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

authored by Ron DuPlain · committed by Armin Ronacher · parent 216478f · Browse files · 19 files+27 added−27 removed
This commit

State

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

Diff stats

19 files+27 added−27 removed

  • other:+27 added−27 removed

19 files+27 added−27 removed

modified:docs/deploying/cgi.rst+1 added-1 removed
36 unmodified lines
37Server Setup38------------3940Usually there are two ways to configure the server. Either just copy the41`.cgi` into a `cgi-bin` (and use `mod_rerwite` or something similar to41`.cgi` into a `cgi-bin` (and use `mod_rewrite` or something similar to42rewrite the URL) or let the server point to the file directly.4344In Apache for example you can put a like like this into the config:45
5 unmodified lines
modified:docs/deploying/fastcgi.rst+1 added-1 removed
121 unmodified lines
122 $ su www-data123 $ cd /var/www/yourapplication124 $ python application.fcgi125 Traceback (most recent call last):126 File "yourapplication.fcg", line 4, in <module>126 File "yourapplication.fcgi", line 4, in <module>127 ImportError: No module named yourapplication128129In this case the error seems to be "yourapplication" not being on the python130path. Common problems are:
9 unmodified lines
modified:docs/deploying/mod_wsgi.rst+2 added-2 removed
91 unmodified lines
92.. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide93.. _virtual python: http://pypi.python.org/pypi/virtualenv94.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/9596Toubleshooting97--------------96Troubleshooting97---------------9899If your application does not run, follow this guide to troubleshoot:100101**Problem:** application does not run, errorlog shows SystemExit ignored
65 unmodified lines
modified:docs/deploying/others.rst+2 added-2 removed
67 unmodified lines
68If you deploy your application behind an HTTP proxy you will need to69rewrite a few headers in order for the application to work. The two70problematic values in the WSGI environment usually are `REMOTE_ADDR` and71`HTTP_HOST`. Werkzeug ships a fixer that will solve some common setups,72but you might want to write your own WSGI middlware for specific setups.72but you might want to write your own WSGI middleware for specific setups.7374The most common setup invokes the host being set from `X-Forwarded-Host`75and the remote address from `X-Forwared-For`::75and the remote address from `X-Forward-For`::7677 from werkzeug.contrib.fixers import ProxyFix78 app.wsgi_app = ProxyFix(app.wsgi_app)79
19 unmodified lines
modified:docs/patterns/errorpages.rst+1 added-1 removed
31 unmodified lines
32 resources that previously existed and got deleted answer with 41033 instead of 404. If you are not deleting documents permanently from34 the database but just mark them as deleted, do the user a favour and35 use the 410 code instead and display a message that what he was36 looking for was deleted for all ethernity.36 looking for was deleted for all eternity.3738*500 Internal Server Error*39 Usually happens on programming errors or if the server is overloaded.40 A terrible good idea to have a nice page there, because your
37 unmodified lines
modified:docs/patterns/fileuploads.rst+3 added-3 removed
39 unmodified lines
4041Why do we limit the extensions that are allowed? You probably don't want42your users to be able to upload everything there if the server is directly43sending out the data to the client. That way you can make sure that users44are not able to upload HTML files that would cause XSS problems. Also45make sure to disallow `.php` files if the server executes them, but who46has PHP installed on his server, right? :)44are not able to upload HTML files that would cause XSS problems (see45:ref:`xss`). Also make sure to disallow `.php` files if the server46executes them, but who has PHP installed on his server, right? :)4748Next the functions that check if an extension is valid and that uploads49the file and redirects the user to the URL for the uploaded file::50
130 unmodified lines
modified:docs/patterns/flashing.rst+2 added-2 removed
28 unmodified lines
29 if request.form['username'] != 'admin' or \30 request.form['password'] != 'secret':31 error = 'Invalid credentials'32 else:33 flash('You were sucessfully logged in')33 flash('You were successfully logged in')34 return redirect(url_for('index'))35 return render_template('login.html', error=error)3637And here the ``layout.html`` template which does the magic:
61 unmodified lines
99 flash(u'Invalid password provided', 'error')100101Inside the template you then have to tell the102:func:`~flask.get_flashed_messages` function to also return the103categories. The loop looks slighty different in that situation then:103categories. The loop looks slightly different in that situation then:104105.. sourcecode:: html+jinja106107 {% with messages = get_flashed_messages(with_categories=true) %}
12 unmodified lines
modified:docs/patterns/lazyloading.rst+1 added-1 removed
98 unmodified lines
99 url('/', 'views.index')100 url('/user/<username>', 'views.user')101102One thing to keep in mind is that before and after request handlers have103to be in a file that is imported upfront to work propery on the first103to be in a file that is imported upfront to work properly on the first104request. The same goes for any kind of remaining decorator.
modified:docs/patterns/mongokit.rst+1 added-1 removed
76 unmodified lines
77validator for the maximum character length and uses a special MongoKit feature78called `use_dot_notation`. Per default MongoKit behaves like a python79dictionary but with `use_dot_notation` set to `True` you can use your80documents like you use models in nearly any other ORM by using dots to81seperate between attributes.81separate between attributes.8283You can insert entries into the database like this:8485>>> from yourapplication.database import connection
59 unmodified lines
modified:docs/patterns/sqlite3.rst+1 added-1 removed
59 unmodified lines
60 print the_username, 'has the id', user['user_id']6162To pass variable parts to the SQL statement, use a question mark in the63statement and pass in the arguments as a list. Never directly add them to64the SQL statement with string formattings because this makes it possible64the SQL statement with string formatting because this makes it possible65to attack the application using `SQL Injections66<http://en.wikipedia.org/wiki/SQL_injection>`_.6768Initial Schemas
19 unmodified lines
modified:docs/patterns/viewdecorators.rst+1 added-1 removed
87 unmodified lines
88 return rv89 return decorated_function90 return decorator9192Notice that this assumes an instanciated `cache` object is available, see92Notice that this assumes an instantiated `cache` object is available, see93:ref:`caching-pattern` for more information.949596Templating Decorator
51 unmodified lines
modified:docs/tutorial/setup.rst+1 added-1 removed
74 unmodified lines
75focus on that a little later. First we should get the database working.7677.. admonition:: Externally Visible Server7879 Want your server to be publically available? Check out the79 Want your server to be publicly available? Check out the80 :ref:`externally visible server <public-server>` section for more81 information.8283Continue with :ref:`tutorial-dbinit`.
modified:docs/becomingbig.rst+1 added-1 removed
8 unmodified lines
910Flask is powered by Werkzeug and Jinja2, two libraries that are in use at11a number of large websites out there and all Flask does is bring those12two together. Being a microframework Flask does not do much more than13combinding existing libraries - there is not a lot of code involved.13combining existing libraries - there is not a lot of code involved.14What that means for large applications is that it's very easy to take the15code from Flask and put it into a new module within the applications and16expand on that.17
71 unmodified lines
modified:docs/config.rst+2 added-2 removed
59 unmodified lines
60 :class:`datetime.timedelta` object.61``USE_X_SENDFILE`` enable/disable x-sendfile62``LOGGER_NAME`` the name of the logger63``SERVER_NAME`` the name of the server. Required for64 subdomain support (eg: ``'localhost'``)64 subdomain support (e.g.: ``'localhost'``)65``MAX_CONTENT_LENGTH`` If set to a value in bytes, Flask will66 reject incoming requests with a67 content length greater than this by68 returning a 413 status code.
152 unmodified lines
221 code at all. If you are working often on different projects you can222 even create your own script for sourcing that activates a virtualenv223 and exports the development configuration for you.224- Use a tool like `fabric`_ in production to push code and225 configurations sepearately to the production server(s). For some225 configurations separately to the production server(s). For some226 details about how to do that, head over to the :ref:`deploy` pattern.227228.. _fabric: http://fabfile.org/
modified:docs/extensiondev.rst+1 added-1 removed
151 unmodified lines
152There are two recommended ways for an extension to initialize:153154initialization functions:155 If your extension is called `helloworld` you might have a function156 called ``init_helloworld(app[, extra_args])`` that initalizes the156 called ``init_helloworld(app[, extra_args])`` that initializes the157 extension for that application. It could attach before / after158 handlers etc.159160classes:
167 unmodified lines
modified:docs/license.rst+1 added-1 removed
2 unmodified lines
34Flask is licensed under a three clause BSD License. It basically means:5do whatever you want with it as long as the copyright in Flask sticks6around, the conditions are not modified and the disclaimer is present.7Furthermore you must not use the names of the authors to promote derivates7Furthermore you must not use the names of the authors to promote derivatives8of the software without written consent.910The full license text can be found below (:ref:`flask-license`). For the11documentation and artwork different licenses apply.
37 unmodified lines
modified:docs/styleguide.rst+3 added-3 removed
70 unmodified lines
71--------------------------7273General whitespace rules:74 - No whitespace for unary operators that are not words75 (eg: ``-``, ``~`` etc.) as well on the inner side of parentheses.75 (e.g.: ``-``, ``~`` etc.) as well on the inner side of parentheses.76 - Whitespace is placed between binary operators.7778 Good::79
70 unmodified lines
150151Docstring conventions:152 All docstrings are formatted with reStructuredText as understood by153 Sphinx. Depending on the number of lines in the docstring, they are154 layed out differently. If it's just one line, the closing triple154 laid out differently. If it's just one line, the closing triple155 quote is on the same line as the opening, otherwise the text is on156 the same line as the opening quote and the triple quote that closes157 the string on its own line::158
2 unmodified lines
161162163 def bar():164 """This is a longer docstring with so much information in there165 that it spans three lines. In this case the closing tripple quote165 that it spans three lines. In this case the closing triple quote166 is on its own line.167 """168169Module header:
31 unmodified lines
modified:docs/templating.rst+1 added-1 removed
142 unmodified lines
143 <p>autoescaping is disabled here144 <p>{{ will_not_be_escaped }}145 {% endautoescape %}146147Whenever you do this, please be very cautious about the varibles you are147Whenever you do this, please be very cautious about the variables you are148using in this block.149150Registering Filters151-------------------
37 unmodified lines
modified:docs/upgrading.rst+1 added-1 removed
50 unmodified lines
51order of after-request handlers. Previously they were called in the order52of the registration, now they are called in reverse order. This change53was made so that Flask behaves more like people expected it to work and54how other systems handle request pre- and postprocessing. If you55dependend on the order of execution of post-request functions, be sure to55depend on the order of execution of post-request functions, be sure to56change the order.5758Another change that breaks backwards compatibility is that context59processors will no longer override values passed directly to the template
78 unmodified lines