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
Provenance
- Commit
8d3ee01- Tree
c1c98ab- Author
Daniel Neuhäuser <ich@danielneuhaeuser.de>- Committer
Daniel Neuhäuser <ich@danielneuhaeuser.de>- Parent 1
5775816- Parent 2
22219f5
18 files changed+48 added−48 removed
modified:docs/deploying/cgi.rst+2 added-2 removed
49 unmodified lines50 your app to be available, works too but the `ScriptAlias` directive won't51 work in that case:52 53 .. sourcecode:: apache54- 54+55 RewriteEngine On56 RewriteCond %{REQUEST_FILENAME} !-f # Don't interfere with static files57 RewriteRule ^(.*)$ /path/to/the/application.cgi/$1 [L]58 59 For more information consult the documentation of your webserver.60 61-.. _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 lines158 :class:`~werkzeug.contrib.fixers.LighttpdCGIRootFix` middleware.159 160 Make sure to apply it only if you are mounting the application the URL161 root. 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 that163 explicitly passing a socket to run() is no longer necessary).164 165 Configuring nginx166 -----------------68 unmodified lines235 - Different python interpreters being used.236 237 .. _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/flupmodified:docs/deploying/mod_wsgi.rst+2 added-2 removed
96 unmodified lines97 Allow from all98 </Directory>99 </VirtualHost>100 101-Note: WSGIDaemonProcess isn't implemented in Windows and Apache will 101+Note: WSGIDaemonProcess isn't implemented in Windows and Apache will102 refuse to run with the above configuration. On a Windows system, eliminate those lines:103 104 .. sourcecode:: apache105 14 unmodified lines120 121 .. _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/list125 126 Troubleshooting127 ---------------128 69 unmodified linesmodified:docs/deploying/uwsgi.rst+1 added-1 removed
61 unmodified lines62 }63 64 .. _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 lines26 from werkzeug.contrib.cache import SimpleCache27 cache = SimpleCache()28 29 If you want to use memcached, make sure to have one of the memcache modules30-supported (you get them from `PyPI <https://pypi.python.org/>`_) and a30+supported (you get them from `PyPI <https://pypi.python.org/pypi>`_) and a31 memcached server running somewhere. This is how you connect to such an32 memcached server then::33 34 from werkzeug.contrib.cache import MemcachedCache8 unmodified lines43 Using a Cache44 -------------45 46 Now how can one use such a cache? There are two very important47-operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and 47+operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and48 :meth:`~werkzeug.contrib.cache.BaseCache.set`. This is how to use them:49 50 To get an item from the cache call51 :meth:`~werkzeug.contrib.cache.BaseCache.get` with a string as key name.18 unmodified linesmodified:docs/patterns/fabric.rst+2 added-2 removed
184 unmodified lines185 - 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.190 191 Working with Fabric is fun and you will notice that it's quite magical to192 type ``fab deploy`` and see your application being deployed automatically193 to one or more remote servers.194 195 196-.. _Fabric: http://fabfile.org/196+.. _Fabric: http://www.fabfile.org/modified:docs/patterns/jquery.rst+1 added-1 removed
162 unmodified lines163 we set earlier.164 165 If you don't get the whole picture, download the `sourcecode166 for this example167-<http://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_167+<https://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_168 from github.modified:docs/patterns/sqlalchemy.rst+3 added-3 removed
108 unmodified lines109 <User u'admin'>110 111 .. _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.html114 115 Manual Object Relational Mapping116 --------------------------------117 67 unmodified lines185 Then you can either declare the tables in your code like in the examples186 above, or automatically load them::187 188 from sqlalchemy import Table189- 189+190 users = Table('users', metadata, autoload=True)191 192 To insert data you can use the `insert` method. We have to get a193 connection first so that we can use a transaction:20 unmodified lines214 >>> engine.execute('select * from users where id = :1', [1]).first()215 (1, u'admin', u'admin@localhost')216 217 For 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 lines121 122 For more information about WTForms, head over to the `WTForms123 website`_.124 125-.. _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 lines74 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.76 77 .. _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 lines14 If you want the full sourcecode in advance or for comparison, check out15 the `example source`_.16 17 .. _example source:18- http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/18+ https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/19 20 .. toctree::21 :maxdepth: 222 10 unmodified linesmodified:docs/config.rst+2 added-2 removed
197 unmodified lines198 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`_.201 202-.. _bind: https://www.isc.org/software/bind202+.. _bind: https://www.isc.org/downloads/bind/203 204 .. versionadded:: 0.4205 ``LOGGER_NAME``206 155 unmodified lines362 configurations separately to the production server(s). For some363 details about how to do that, head over to the364 :ref:`fabric-deployment` pattern.365 366-.. _fabric: http://fabfile.org/366+.. _fabric: http://www.fabfile.org/367 368 369 .. _instance-folders:370 80 unmodified linesmodified:docs/extensions.rst+1 added-1 removed
43 unmodified lines44 Once the ``flaskext_compat`` module is activated the :data:`flask.ext` will45 exist and you can start importing from there.46 47 .. _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.pymodified:docs/htmlfaq.rst+1 added-1 removed
184 unmodified lines185 Many other features have been added, as well. A good guide to new features186 in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_.187 Not all of them are supported in browsers yet, however, so use caution.188 189-.. _Dive Into HTML5: http://www.diveintohtml5.info/189+.. _Dive Into HTML5: http://diveintohtml5.info/190 191 What should be used?192 --------------------193 14 unmodified linesmodified:docs/installation.rst+2 added-2 removed
178 unmodified lines179 180 Finally, to install `virtualenv`_, you can simply run::181 182 > pip install virtualenv183- 183+184 Then you can be off on your way following the installation instructions above.185 186-.. _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.pymodified:docs/quickstart.rst+2 added-2 removed
39 unmodified lines40 41 So what did that code do?42 43 1. 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.45 2. 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 different828 unmodified lines877 Ready to deploy your new Flask app? To wrap up the quickstart, you can878 immediately deploy to a hosted platform, all of which offer a free plan for879 small projects:880 881-- `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/>`_884 885 Other places where you can host your Flask app:7 unmodified linesmodified:docs/testing.rst+18 added-18 removed
9 unmodified lines10 improve existing code and developers of untested applications tend to11 become pretty paranoid. If an application has automated tests, you can12 safely make changes and instantly know if anything breaks.13 14-Flask provides a way to test your application by exposing the Werkzeug 14+Flask provides a way to test your application by exposing the Werkzeug15 test :class:`~werkzeug.test.Client` and handling the context locals for you.16 You can then use that with your favourite testing solution. In this documentation17 we will use the :mod:`unittest` package that comes pre-installed with Python.18 19 The Application20 ---------------21 22-First, we need an application to test; we will use the application from 23-the :ref:`tutorial`. If you don't have that application yet, get the 22+First, we need an application to test; we will use the application from23+the :ref:`tutorial`. If you don't have that application yet, get the24 sources from `the examples`_.25 26 .. _the examples:27- http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/27+ https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/28 29 The Testing Skeleton30 --------------------31 32-In order to test the application, we add a second module 32+In order to test the application, we add a second module33 (`flaskr_tests.py`) and create a unittest skeleton there::34 35 import os36 import flaskr17 unmodified lines54 unittest.main()55 56 The code in the :meth:`~unittest.TestCase.setUp` method creates a new test57 client and initializes a new database. This function is called before58-each individual test function is run. To delete the database after the 58+each individual test function is run. To delete the database after the59 test, 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 error62 catching during request handling so that you get better error reports when63 performing test requests against the application.64 65-This test client will give us a simple interface to the application. We can 66-trigger test requests to the application, and the client will also keep track 65+This test client will give us a simple interface to the application. We can66+trigger test requests to the application, and the client will also keep track67 of cookies for us.68 69 Because SQLite3 is filesystem-based we can easily use the tempfile module70 to create a temporary database and initialize it. The17 unmodified lines88 89 The First Test90 --------------91 92-Now it's time to start testing the functionality of the application. 93-Let's check that the application shows "No entries here so far" if we 92+Now it's time to start testing the functionality of the application.93+Let's check that the application shows "No entries here so far" if we94 access the root of the application (``/``). To do this, we add a new95 test method to our class, like this::96 97 class FlaskrTestCase(unittest.TestCase):10 unmodified lines108 def test_empty_db(self):109 rv = self.app.get('/')110 assert 'No entries here so far' in rv.data111 112-Notice that our test functions begin with the word `test`; this allows 113-:mod:`unittest` to automatically identify the method as a test to run. 112+Notice that our test functions begin with the word `test`; this allows113+:mod:`unittest` to automatically identify the method as a test to run.114 115-By using `self.app.get` we can send an HTTP `GET` request to the application with 116-the given path. The return value will be a :class:`~flask.Flask.response_class` object. 115+By using `self.app.get` we can send an HTTP `GET` request to the application with116+the given path. The return value will be a :class:`~flask.Flask.response_class` object.117 We can now use the :attr:`~werkzeug.wrappers.BaseResponse.data` attribute to inspect118-the return value (as string) from the application. In this case, we ensure that 118+the return value (as string) from the application. In this case, we ensure that119 ``'No entries here so far'`` is part of the output.120 121 Run it again and you should see one passing test::122 8 unmodified lines131 ------------------132 133 The majority of the functionality of our application is only available for134 the administrative user, so we need a way to log our test client in and out135-of the application. To do this, we fire some requests to the login and logout 136-pages with the required form data (username and password). And because the 135+of the application. To do this, we fire some requests to the login and logout136+pages with the required form data (username and password). And because the137 login and logout pages redirect, we tell the client to `follow_redirects`.138 139 Add the following two methods to your `FlaskrTestCase` class::140 52 unmodified lines193 suite.194 195 196 .. _MiniTwit Example:197- http://github.com/mitsuhiko/flask/tree/master/examples/minitwit/197+ https://github.com/mitsuhiko/flask/tree/master/examples/minitwit/198 199 200 Other Testing Tricks201 --------------------152 unmodified linesmodified:docs/upgrading.rst+2 added-2 removed
62 unmodified lines63 If you maintain an extension that was using :data:`~flask._request_ctx_stack`64 before, please consider changing to :data:`~flask._app_ctx_stack` if it makes65 sense for your extension. For instance, the app context stack makes sense for66 extensions which connect to databases. Using the app context stack instead of67-the request context stack will make extensions more readily handle use cases 67+the request context stack will make extensions more readily handle use cases68 outside of requests.69 70 Version 0.871 -----------42 unmodified lines114 115 To apply the upgrade script do the following:116 117 1. 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>`_119 2. Run it in the directory of your application::120 121 python flask-07-upgrade.py > patchfile.diff122 250 unmodified lines