Skip to content
Myr

Merge pull request #1132 from nicorevin/update_links

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

Update doclinks

authored by Daniel Neuhäuser · committed by Daniel Neuhäuser · parents 5775816, 22219f5 · Browse files · 18 files+48 added−48 removed
This commit

State

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

Diff stats

18 files+48 added−48 removed

  • other:+48 added−48 removed

18 files+48 added−48 removed

modified:docs/deploying/cgi.rst+2 added-2 removed
49 unmodified lines
50your app to be available, works too but the `ScriptAlias` directive won't51work in that case:5253.. sourcecode:: apache54 5455 RewriteEngine On56 RewriteCond %{REQUEST_FILENAME} !-f # Don't interfere with static files57 RewriteRule ^(.*)$ /path/to/the/application.cgi/$1 [L]5859For more information consult the documentation of your webserver.6061.. _App Engine: http://code.google.com/appengine/61.. _App Engine: https://developers.google.com/appengine/
modified:docs/deploying/fastcgi.rst+3 added-3 removed
157 unmodified lines
158:class:`~werkzeug.contrib.fixers.LighttpdCGIRootFix` middleware.159160Make sure to apply it only if you are mounting the application the URL161root. Also, see the Lighty docs for more information on `FastCGI and Python162<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ (note that162<http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI>`_ (note that163explicitly passing a socket to run() is no longer necessary).164165Configuring nginx166-----------------
68 unmodified lines
235- Different python interpreters being used.236237.. _nginx: http://nginx.org/238.. _lighttpd: http://www.lighttpd.net/239.. _cherokee: http://www.cherokee-project.com/240.. _flup: http://trac.saddi.com/flup239.. _cherokee: http://cherokee-project.com/240.. _flup: https://pypi.python.org/pypi/flup
modified:docs/deploying/mod_wsgi.rst+2 added-2 removed
96 unmodified lines
97 Allow from all98 </Directory>99 </VirtualHost>100101Note: WSGIDaemonProcess isn't implemented in Windows and Apache will 101Note: WSGIDaemonProcess isn't implemented in Windows and Apache will102refuse to run with the above configuration. On a Windows system, eliminate those lines:103104.. sourcecode:: apache105
14 unmodified lines
120121.. _mod_wsgi: http://code.google.com/p/modwsgi/122.. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide123.. _virtual python: https://pypi.python.org/pypi/virtualenv124.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/124.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/w/list125126Troubleshooting127---------------128
69 unmodified lines
modified:docs/deploying/uwsgi.rst+1 added-1 removed
61 unmodified lines
62 }6364.. _nginx: http://nginx.org/65.. _lighttpd: http://www.lighttpd.net/66.. _cherokee: http://www.cherokee-project.com/66.. _cherokee: http://cherokee-project.com/67.. _uwsgi: http://projects.unbit.it/uwsgi/
modified:docs/patterns/caching.rst+2 added-2 removed
25 unmodified lines
26 from werkzeug.contrib.cache import SimpleCache27 cache = SimpleCache()2829If you want to use memcached, make sure to have one of the memcache modules30supported (you get them from `PyPI <https://pypi.python.org/>`_) and a30supported (you get them from `PyPI <https://pypi.python.org/pypi>`_) and a31memcached server running somewhere. This is how you connect to such an32memcached server then::3334 from werkzeug.contrib.cache import MemcachedCache
8 unmodified lines
43Using a Cache44-------------4546Now how can one use such a cache? There are two very important47operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and 47operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and48:meth:`~werkzeug.contrib.cache.BaseCache.set`. This is how to use them:4950To get an item from the cache call51:meth:`~werkzeug.contrib.cache.BaseCache.get` with a string as key name.
18 unmodified lines
modified:docs/patterns/fabric.rst+2 added-2 removed
184 unmodified lines
185- You could also put your application code into a repository and check186 out the latest version on the server and then install. That way you187 can also easily go back to older versions.188- hook in testing functionality so that you can deploy to an external189 server and run the testsuite. 189 server and run the testsuite.190191Working with Fabric is fun and you will notice that it's quite magical to192type ``fab deploy`` and see your application being deployed automatically193to one or more remote servers.194195196.. _Fabric: http://fabfile.org/196.. _Fabric: http://www.fabfile.org/
modified:docs/patterns/jquery.rst+1 added-1 removed
162 unmodified lines
163 we set earlier.164165If you don't get the whole picture, download the `sourcecode166for this example167<http://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_167<https://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_168from github.
modified:docs/patterns/sqlalchemy.rst+3 added-3 removed
108 unmodified lines
109<User u'admin'>110111.. _SQLAlchemy: http://www.sqlalchemy.org/112.. _declarative:113 http://www.sqlalchemy.org/docs/orm/extensions/declarative.html113 http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative.html114115Manual Object Relational Mapping116--------------------------------117
67 unmodified lines
185Then you can either declare the tables in your code like in the examples186above, or automatically load them::187188 from sqlalchemy import Table189 189190 users = Table('users', metadata, autoload=True)191192To insert data you can use the `insert` method. We have to get a193connection first so that we can use a transaction:
20 unmodified lines
214>>> engine.execute('select * from users where id = :1', [1]).first()215(1, u'admin', u'admin@localhost')216217For more information about SQLAlchemy, head over to the218`website <http://sqlalchemy.org/>`_.218`website <http://www.sqlalchemy.org/>`_.
modified:docs/patterns/wtforms.rst+2 added-2 removed
120 unmodified lines
121122For more information about WTForms, head over to the `WTForms123website`_.124125.. _WTForms: http://wtforms.simplecodes.com/126.. _WTForms website: http://wtforms.simplecodes.com/125.. _WTForms: http://wtforms.readthedocs.org/126.. _WTForms website: http://wtforms.readthedocs.org/
modified:docs/tutorial/dbcon.rst+1 added-1 removed
73 unmodified lines
74 into a single Python module. You don't have to, and if your app :ref:`grows75 larger <larger-applications>`, it's a good idea not to.7677.. _example source:78 http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/78 https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
modified:docs/tutorial/index.rst+1 added-1 removed
13 unmodified lines
14If you want the full sourcecode in advance or for comparison, check out15the `example source`_.1617.. _example source:18 http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/18 https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/1920.. toctree::21 :maxdepth: 222
10 unmodified lines
modified:docs/config.rst+2 added-2 removed
197 unmodified lines
198 server name in that case, like ``'myapplication.local'`` and add199 this name + the subdomains you want to use into your host config200 or setup a local `bind`_.201202.. _bind: https://www.isc.org/software/bind202.. _bind: https://www.isc.org/downloads/bind/203204.. versionadded:: 0.4205 ``LOGGER_NAME``206
155 unmodified lines
362 configurations separately to the production server(s). For some363 details about how to do that, head over to the364 :ref:`fabric-deployment` pattern.365366.. _fabric: http://fabfile.org/366.. _fabric: http://www.fabfile.org/367368369.. _instance-folders:370
80 unmodified lines
modified:docs/extensions.rst+1 added-1 removed
43 unmodified lines
44Once the ``flaskext_compat`` module is activated the :data:`flask.ext` will45exist and you can start importing from there.4647.. _Flask Extension Registry: http://flask.pocoo.org/extensions/48.. _flaskext_compat.py: https://github.com/mitsuhiko/flask/raw/master/scripts/flaskext_compat.py48.. _flaskext_compat.py: https://raw.githubusercontent.com/mitsuhiko/flask/master/scripts/flaskext_compat.py
modified:docs/htmlfaq.rst+1 added-1 removed
184 unmodified lines
185Many other features have been added, as well. A good guide to new features186in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_.187Not all of them are supported in browsers yet, however, so use caution.188189.. _Dive Into HTML5: http://www.diveintohtml5.info/189.. _Dive Into HTML5: http://diveintohtml5.info/190191What should be used?192--------------------193
14 unmodified lines
modified:docs/installation.rst+2 added-2 removed
178 unmodified lines
179180Finally, to install `virtualenv`_, you can simply run::181182 > pip install virtualenv183 183184Then you can be off on your way following the installation instructions above.185186.. _get-pip.py: https://raw.github.com/pypa/pip/master/contrib/get-pip.py186.. _get-pip.py: https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py187.. _ez_setup.py: https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
modified:docs/quickstart.rst+2 added-2 removed
39 unmodified lines
4041So what did that code do?42431. First we imported the :class:`~flask.Flask` class. An instance of this44 class will be our WSGI application. 44 class will be our WSGI application.452. Next we create an instance of this class. The first argument is the name of46 the application's module or package. If you are using a single module (as47 in this example), you should use `__name__` because depending on if it's48 started as application or imported as module the name will be different
828 unmodified lines
877Ready to deploy your new Flask app? To wrap up the quickstart, you can878immediately deploy to a hosted platform, all of which offer a free plan for879small projects:880881- `Deploying Flask on Heroku <https://devcenter.heroku.com/articles/python>`_881- `Deploying Flask on Heroku <https://devcenter.heroku.com/articles/getting-started-with-python>`_882- `Deploying WSGI on dotCloud <http://docs.dotcloud.com/services/python/>`_883 with `Flask-specific notes <http://flask.pocoo.org/snippets/48/>`_884885Other places where you can host your Flask app:
7 unmodified lines
modified:docs/testing.rst+18 added-18 removed
9 unmodified lines
10improve existing code and developers of untested applications tend to11become pretty paranoid. If an application has automated tests, you can12safely make changes and instantly know if anything breaks.1314Flask provides a way to test your application by exposing the Werkzeug 14Flask provides a way to test your application by exposing the Werkzeug15test :class:`~werkzeug.test.Client` and handling the context locals for you.16You can then use that with your favourite testing solution. In this documentation17we will use the :mod:`unittest` package that comes pre-installed with Python.1819The Application20---------------2122First, we need an application to test; we will use the application from 23the :ref:`tutorial`. If you don't have that application yet, get the 22First, we need an application to test; we will use the application from23the :ref:`tutorial`. If you don't have that application yet, get the24sources from `the examples`_.2526.. _the examples:27 http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/27 https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/2829The Testing Skeleton30--------------------3132In order to test the application, we add a second module 32In order to test the application, we add a second module33(`flaskr_tests.py`) and create a unittest skeleton there::3435 import os36 import flaskr
17 unmodified lines
54 unittest.main()5556The code in the :meth:`~unittest.TestCase.setUp` method creates a new test57client and initializes a new database. This function is called before58each individual test function is run. To delete the database after the 58each individual test function is run. To delete the database after the59test, we close the file and remove it from the filesystem in the60:meth:`~unittest.TestCase.tearDown` method. Additionally during setup the61``TESTING`` config flag is activated. What it does is disabling the error62catching during request handling so that you get better error reports when63performing test requests against the application.6465This test client will give us a simple interface to the application. We can 66trigger test requests to the application, and the client will also keep track 65This test client will give us a simple interface to the application. We can66trigger test requests to the application, and the client will also keep track67of cookies for us.6869Because SQLite3 is filesystem-based we can easily use the tempfile module70to create a temporary database and initialize it. The
17 unmodified lines
8889The First Test90--------------9192Now it's time to start testing the functionality of the application. 93Let's check that the application shows "No entries here so far" if we 92Now it's time to start testing the functionality of the application.93Let's check that the application shows "No entries here so far" if we94access the root of the application (``/``). To do this, we add a new95test method to our class, like this::9697 class FlaskrTestCase(unittest.TestCase):
10 unmodified lines
108 def test_empty_db(self):109 rv = self.app.get('/')110 assert 'No entries here so far' in rv.data111112Notice that our test functions begin with the word `test`; this allows 113:mod:`unittest` to automatically identify the method as a test to run. 112Notice that our test functions begin with the word `test`; this allows113:mod:`unittest` to automatically identify the method as a test to run.114115By using `self.app.get` we can send an HTTP `GET` request to the application with 116the given path. The return value will be a :class:`~flask.Flask.response_class` object. 115By using `self.app.get` we can send an HTTP `GET` request to the application with116the given path. The return value will be a :class:`~flask.Flask.response_class` object.117We can now use the :attr:`~werkzeug.wrappers.BaseResponse.data` attribute to inspect118the return value (as string) from the application. In this case, we ensure that 118the return value (as string) from the application. In this case, we ensure that119``'No entries here so far'`` is part of the output.120121Run it again and you should see one passing test::122
8 unmodified lines
131------------------132133The majority of the functionality of our application is only available for134the administrative user, so we need a way to log our test client in and out135of the application. To do this, we fire some requests to the login and logout 136pages with the required form data (username and password). And because the 135of the application. To do this, we fire some requests to the login and logout136pages with the required form data (username and password). And because the137login and logout pages redirect, we tell the client to `follow_redirects`.138139Add the following two methods to your `FlaskrTestCase` class::140
52 unmodified lines
193suite.194195196.. _MiniTwit Example:197 http://github.com/mitsuhiko/flask/tree/master/examples/minitwit/197 https://github.com/mitsuhiko/flask/tree/master/examples/minitwit/198199200Other Testing Tricks201--------------------
152 unmodified lines
modified:docs/upgrading.rst+2 added-2 removed
62 unmodified lines
63If you maintain an extension that was using :data:`~flask._request_ctx_stack`64before, please consider changing to :data:`~flask._app_ctx_stack` if it makes65sense for your extension. For instance, the app context stack makes sense for66extensions which connect to databases. Using the app context stack instead of67the request context stack will make extensions more readily handle use cases 67the request context stack will make extensions more readily handle use cases68outside of requests.6970Version 0.871-----------
42 unmodified lines
114115To apply the upgrade script do the following:1161171. Download the script: `flask-07-upgrade.py118 <https://raw.github.com/mitsuhiko/flask/master/scripts/flask-07-upgrade.py>`_118 <https://raw.githubusercontent.com/mitsuhiko/flask/master/scripts/flask-07-upgrade.py>`_1192. Run it in the directory of your application::120121 python flask-07-upgrade.py > patchfile.diff122
250 unmodified lines