Update doclinks
Fix redirects and broken links
This commit is contained in:
parent
577581665c
commit
22219f51e5
18 changed files with 48 additions and 48 deletions
|
|
@ -199,7 +199,7 @@ The following configuration values are used internally by Flask:
|
|||
this name + the subdomains you want to use into your host config
|
||||
or setup a local `bind`_.
|
||||
|
||||
.. _bind: https://www.isc.org/software/bind
|
||||
.. _bind: https://www.isc.org/downloads/bind/
|
||||
|
||||
.. versionadded:: 0.4
|
||||
``LOGGER_NAME``
|
||||
|
|
@ -363,7 +363,7 @@ your configuration files. However here a list of good recommendations:
|
|||
details about how to do that, head over to the
|
||||
:ref:`fabric-deployment` pattern.
|
||||
|
||||
.. _fabric: http://fabfile.org/
|
||||
.. _fabric: http://www.fabfile.org/
|
||||
|
||||
|
||||
.. _instance-folders:
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ your app to be available, works too but the `ScriptAlias` directive won't
|
|||
work in that case:
|
||||
|
||||
.. sourcecode:: apache
|
||||
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f # Don't interfere with static files
|
||||
RewriteRule ^(.*)$ /path/to/the/application.cgi/$1 [L]
|
||||
|
||||
For more information consult the documentation of your webserver.
|
||||
|
||||
.. _App Engine: http://code.google.com/appengine/
|
||||
.. _App Engine: https://developers.google.com/appengine/
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ work in the URL root you have to work around a lighttpd bug with the
|
|||
|
||||
Make sure to apply it only if you are mounting the application the URL
|
||||
root. Also, see the Lighty docs for more information on `FastCGI and Python
|
||||
<http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI>`_ (note that
|
||||
<http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI>`_ (note that
|
||||
explicitly passing a socket to run() is no longer necessary).
|
||||
|
||||
Configuring nginx
|
||||
|
|
@ -236,5 +236,5 @@ python path. Common problems are:
|
|||
|
||||
.. _nginx: http://nginx.org/
|
||||
.. _lighttpd: http://www.lighttpd.net/
|
||||
.. _cherokee: http://www.cherokee-project.com/
|
||||
.. _flup: http://trac.saddi.com/flup
|
||||
.. _cherokee: http://cherokee-project.com/
|
||||
.. _flup: https://pypi.python.org/pypi/flup
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ execute the application under a different user for security reasons:
|
|||
</Directory>
|
||||
</VirtualHost>
|
||||
|
||||
Note: WSGIDaemonProcess isn't implemented in Windows and Apache will
|
||||
Note: WSGIDaemonProcess isn't implemented in Windows and Apache will
|
||||
refuse to run with the above configuration. On a Windows system, eliminate those lines:
|
||||
|
||||
.. sourcecode:: apache
|
||||
|
|
@ -121,7 +121,7 @@ For more information consult the `mod_wsgi wiki`_.
|
|||
.. _mod_wsgi: http://code.google.com/p/modwsgi/
|
||||
.. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
|
||||
.. _virtual python: https://pypi.python.org/pypi/virtualenv
|
||||
.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/
|
||||
.. _mod_wsgi wiki: http://code.google.com/p/modwsgi/w/list
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
|
|
|||
|
|
@ -63,5 +63,5 @@ it the WSGI `SCRIPT_NAME` or set the uwsgi modifier to make use of it::
|
|||
|
||||
.. _nginx: http://nginx.org/
|
||||
.. _lighttpd: http://www.lighttpd.net/
|
||||
.. _cherokee: http://www.cherokee-project.com/
|
||||
.. _cherokee: http://cherokee-project.com/
|
||||
.. _uwsgi: http://projects.unbit.it/uwsgi/
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@ Once the ``flaskext_compat`` module is activated the :data:`flask.ext` will
|
|||
exist and you can start importing from there.
|
||||
|
||||
.. _Flask Extension Registry: http://flask.pocoo.org/extensions/
|
||||
.. _flaskext_compat.py: https://github.com/mitsuhiko/flask/raw/master/scripts/flaskext_compat.py
|
||||
.. _flaskext_compat.py: https://raw.githubusercontent.com/mitsuhiko/flask/master/scripts/flaskext_compat.py
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ Many other features have been added, as well. A good guide to new features
|
|||
in HTML5 is Mark Pilgrim's soon-to-be-published book, `Dive Into HTML5`_.
|
||||
Not all of them are supported in browsers yet, however, so use caution.
|
||||
|
||||
.. _Dive Into HTML5: http://www.diveintohtml5.info/
|
||||
.. _Dive Into HTML5: http://diveintohtml5.info/
|
||||
|
||||
What should be used?
|
||||
--------------------
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ check that you can now just type ``python`` to bring up the interpreter.
|
|||
Finally, to install `virtualenv`_, you can simply run::
|
||||
|
||||
> pip install virtualenv
|
||||
|
||||
|
||||
Then you can be off on your way following the installation instructions above.
|
||||
|
||||
.. _get-pip.py: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
|
||||
.. _get-pip.py: https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
|
||||
.. _ez_setup.py: https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ cache that keeps the item stored in the memory of the Python interpreter::
|
|||
cache = SimpleCache()
|
||||
|
||||
If you want to use memcached, make sure to have one of the memcache modules
|
||||
supported (you get them from `PyPI <https://pypi.python.org/>`_) and a
|
||||
supported (you get them from `PyPI <https://pypi.python.org/pypi>`_) and a
|
||||
memcached server running somewhere. This is how you connect to such an
|
||||
memcached server then::
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ Using a Cache
|
|||
-------------
|
||||
|
||||
Now how can one use such a cache? There are two very important
|
||||
operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and
|
||||
operations: :meth:`~werkzeug.contrib.cache.BaseCache.get` and
|
||||
:meth:`~werkzeug.contrib.cache.BaseCache.set`. This is how to use them:
|
||||
|
||||
To get an item from the cache call
|
||||
|
|
|
|||
|
|
@ -186,11 +186,11 @@ deployment actually fun:
|
|||
out the latest version on the server and then install. That way you
|
||||
can also easily go back to older versions.
|
||||
- hook in testing functionality so that you can deploy to an external
|
||||
server and run the testsuite.
|
||||
server and run the testsuite.
|
||||
|
||||
Working with Fabric is fun and you will notice that it's quite magical to
|
||||
type ``fab deploy`` and see your application being deployed automatically
|
||||
to one or more remote servers.
|
||||
|
||||
|
||||
.. _Fabric: http://fabfile.org/
|
||||
.. _Fabric: http://www.fabfile.org/
|
||||
|
|
|
|||
|
|
@ -164,5 +164,5 @@ explanation of the little bit of code above:
|
|||
|
||||
If you don't get the whole picture, download the `sourcecode
|
||||
for this example
|
||||
<http://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_
|
||||
<https://github.com/mitsuhiko/flask/tree/master/examples/jqueryexample>`_
|
||||
from github.
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ Querying is simple as well:
|
|||
|
||||
.. _SQLAlchemy: http://www.sqlalchemy.org/
|
||||
.. _declarative:
|
||||
http://www.sqlalchemy.org/docs/orm/extensions/declarative.html
|
||||
http://docs.sqlalchemy.org/en/latest/orm/extensions/declarative.html
|
||||
|
||||
Manual Object Relational Mapping
|
||||
--------------------------------
|
||||
|
|
@ -186,7 +186,7 @@ Then you can either declare the tables in your code like in the examples
|
|||
above, or automatically load them::
|
||||
|
||||
from sqlalchemy import Table
|
||||
|
||||
|
||||
users = Table('users', metadata, autoload=True)
|
||||
|
||||
To insert data you can use the `insert` method. We have to get a
|
||||
|
|
@ -215,4 +215,4 @@ You can also pass strings of SQL statements to the
|
|||
(1, u'admin', u'admin@localhost')
|
||||
|
||||
For more information about SQLAlchemy, head over to the
|
||||
`website <http://sqlalchemy.org/>`_.
|
||||
`website <http://www.sqlalchemy.org/>`_.
|
||||
|
|
|
|||
|
|
@ -122,5 +122,5 @@ takes advantage of the `_formhelpers.html` template:
|
|||
For more information about WTForms, head over to the `WTForms
|
||||
website`_.
|
||||
|
||||
.. _WTForms: http://wtforms.simplecodes.com/
|
||||
.. _WTForms website: http://wtforms.simplecodes.com/
|
||||
.. _WTForms: http://wtforms.readthedocs.org/
|
||||
.. _WTForms website: http://wtforms.readthedocs.org/
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ should see your hello world greeting.
|
|||
So what did that code do?
|
||||
|
||||
1. First we imported the :class:`~flask.Flask` class. An instance of this
|
||||
class will be our WSGI application.
|
||||
class will be our WSGI application.
|
||||
2. Next we create an instance of this class. The first argument is the name of
|
||||
the application's module or package. If you are using a single module (as
|
||||
in this example), you should use `__name__` because depending on if it's
|
||||
|
|
@ -878,7 +878,7 @@ Ready to deploy your new Flask app? To wrap up the quickstart, you can
|
|||
immediately deploy to a hosted platform, all of which offer a free plan for
|
||||
small projects:
|
||||
|
||||
- `Deploying Flask on Heroku <https://devcenter.heroku.com/articles/python>`_
|
||||
- `Deploying Flask on Heroku <https://devcenter.heroku.com/articles/getting-started-with-python>`_
|
||||
- `Deploying WSGI on dotCloud <http://docs.dotcloud.com/services/python/>`_
|
||||
with `Flask-specific notes <http://flask.pocoo.org/snippets/48/>`_
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ improve existing code and developers of untested applications tend to
|
|||
become pretty paranoid. If an application has automated tests, you can
|
||||
safely make changes and instantly know if anything breaks.
|
||||
|
||||
Flask provides a way to test your application by exposing the Werkzeug
|
||||
Flask provides a way to test your application by exposing the Werkzeug
|
||||
test :class:`~werkzeug.test.Client` and handling the context locals for you.
|
||||
You can then use that with your favourite testing solution. In this documentation
|
||||
we will use the :mod:`unittest` package that comes pre-installed with Python.
|
||||
|
|
@ -19,17 +19,17 @@ we will use the :mod:`unittest` package that comes pre-installed with Python.
|
|||
The Application
|
||||
---------------
|
||||
|
||||
First, we need an application to test; we will use the application from
|
||||
the :ref:`tutorial`. If you don't have that application yet, get the
|
||||
First, we need an application to test; we will use the application from
|
||||
the :ref:`tutorial`. If you don't have that application yet, get the
|
||||
sources from `the examples`_.
|
||||
|
||||
.. _the examples:
|
||||
http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
|
||||
https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
|
||||
|
||||
The Testing Skeleton
|
||||
--------------------
|
||||
|
||||
In order to test the application, we add a second module
|
||||
In order to test the application, we add a second module
|
||||
(`flaskr_tests.py`) and create a unittest skeleton there::
|
||||
|
||||
import os
|
||||
|
|
@ -55,15 +55,15 @@ In order to test the application, we add a second module
|
|||
|
||||
The code in the :meth:`~unittest.TestCase.setUp` method creates a new test
|
||||
client and initializes a new database. This function is called before
|
||||
each individual test function is run. To delete the database after the
|
||||
each individual test function is run. To delete the database after the
|
||||
test, we close the file and remove it from the filesystem in the
|
||||
:meth:`~unittest.TestCase.tearDown` method. Additionally during setup the
|
||||
``TESTING`` config flag is activated. What it does is disabling the error
|
||||
catching during request handling so that you get better error reports when
|
||||
performing test requests against the application.
|
||||
|
||||
This test client will give us a simple interface to the application. We can
|
||||
trigger test requests to the application, and the client will also keep track
|
||||
This test client will give us a simple interface to the application. We can
|
||||
trigger test requests to the application, and the client will also keep track
|
||||
of cookies for us.
|
||||
|
||||
Because SQLite3 is filesystem-based we can easily use the tempfile module
|
||||
|
|
@ -89,8 +89,8 @@ with an exception.
|
|||
The First Test
|
||||
--------------
|
||||
|
||||
Now it's time to start testing the functionality of the application.
|
||||
Let's check that the application shows "No entries here so far" if we
|
||||
Now it's time to start testing the functionality of the application.
|
||||
Let's check that the application shows "No entries here so far" if we
|
||||
access the root of the application (``/``). To do this, we add a new
|
||||
test method to our class, like this::
|
||||
|
||||
|
|
@ -109,13 +109,13 @@ test method to our class, like this::
|
|||
rv = self.app.get('/')
|
||||
assert 'No entries here so far' in rv.data
|
||||
|
||||
Notice that our test functions begin with the word `test`; this allows
|
||||
:mod:`unittest` to automatically identify the method as a test to run.
|
||||
Notice that our test functions begin with the word `test`; this allows
|
||||
:mod:`unittest` to automatically identify the method as a test to run.
|
||||
|
||||
By using `self.app.get` we can send an HTTP `GET` request to the application with
|
||||
the given path. The return value will be a :class:`~flask.Flask.response_class` object.
|
||||
By using `self.app.get` we can send an HTTP `GET` request to the application with
|
||||
the given path. The return value will be a :class:`~flask.Flask.response_class` object.
|
||||
We can now use the :attr:`~werkzeug.wrappers.BaseResponse.data` attribute to inspect
|
||||
the return value (as string) from the application. In this case, we ensure that
|
||||
the return value (as string) from the application. In this case, we ensure that
|
||||
``'No entries here so far'`` is part of the output.
|
||||
|
||||
Run it again and you should see one passing test::
|
||||
|
|
@ -132,8 +132,8 @@ Logging In and Out
|
|||
|
||||
The majority of the functionality of our application is only available for
|
||||
the administrative user, so we need a way to log our test client in and out
|
||||
of the application. To do this, we fire some requests to the login and logout
|
||||
pages with the required form data (username and password). And because the
|
||||
of the application. To do this, we fire some requests to the login and logout
|
||||
pages with the required form data (username and password). And because the
|
||||
login and logout pages redirect, we tell the client to `follow_redirects`.
|
||||
|
||||
Add the following two methods to your `FlaskrTestCase` class::
|
||||
|
|
@ -194,7 +194,7 @@ suite.
|
|||
|
||||
|
||||
.. _MiniTwit Example:
|
||||
http://github.com/mitsuhiko/flask/tree/master/examples/minitwit/
|
||||
https://github.com/mitsuhiko/flask/tree/master/examples/minitwit/
|
||||
|
||||
|
||||
Other Testing Tricks
|
||||
|
|
|
|||
|
|
@ -75,4 +75,4 @@ Continue to :ref:`tutorial-dbinit`.
|
|||
larger <larger-applications>`, it's a good idea not to.
|
||||
|
||||
.. _example source:
|
||||
http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
|
||||
https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ If you want the full sourcecode in advance or for comparison, check out
|
|||
the `example source`_.
|
||||
|
||||
.. _example source:
|
||||
http://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
|
||||
https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ If you maintain an extension that was using :data:`~flask._request_ctx_stack`
|
|||
before, please consider changing to :data:`~flask._app_ctx_stack` if it makes
|
||||
sense for your extension. For instance, the app context stack makes sense for
|
||||
extensions which connect to databases. Using the app context stack instead of
|
||||
the request context stack will make extensions more readily handle use cases
|
||||
the request context stack will make extensions more readily handle use cases
|
||||
outside of requests.
|
||||
|
||||
Version 0.8
|
||||
|
|
@ -115,7 +115,7 @@ good.
|
|||
To apply the upgrade script do the following:
|
||||
|
||||
1. Download the script: `flask-07-upgrade.py
|
||||
<https://raw.github.com/mitsuhiko/flask/master/scripts/flask-07-upgrade.py>`_
|
||||
<https://raw.githubusercontent.com/mitsuhiko/flask/master/scripts/flask-07-upgrade.py>`_
|
||||
2. Run it in the directory of your application::
|
||||
|
||||
python flask-07-upgrade.py > patchfile.diff
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue