mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #26483 -- Updated docs.python.org links to use Intersphinx.
This commit is contained in:
parent
413f3bb5c8
commit
f5ff5010cd
20 changed files with 75 additions and 108 deletions
|
@ -373,10 +373,9 @@ that passing a ``prefix`` parameter when creating an instance still works too.
|
|||
* Dive Into Python (a free online book for beginning Python developers)
|
||||
includes a great `introduction to Unit Testing`__.
|
||||
* After reading those, if you want something a little meatier to sink
|
||||
your teeth into, there's always the `Python unittest documentation`__.
|
||||
your teeth into, there's always the Python :mod:`unittest` documentation.
|
||||
|
||||
__ http://www.diveintopython.net/unit_testing/index.html
|
||||
__ https://docs.python.org/library/unittest.html
|
||||
|
||||
Running your new test
|
||||
---------------------
|
||||
|
|
|
@ -201,15 +201,13 @@ example above:
|
|||
url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail),
|
||||
]
|
||||
|
||||
The code above maps URLs, as simple `regular expressions`_, to the location of
|
||||
Python callback functions ("views"). The regular expressions use parenthesis to
|
||||
"capture" values from the URLs. When a user requests a page, Django runs
|
||||
through each pattern, in order, and stops at the first one that matches the
|
||||
requested URL. (If none of them matches, Django calls a special-case 404 view.)
|
||||
This is blazingly fast, because the regular expressions are compiled at load
|
||||
time.
|
||||
|
||||
.. _regular expressions: https://docs.python.org/howto/regex.html
|
||||
The code above maps URLs, as simple :ref:`regular expressions <regex-howto>`,
|
||||
to the location of Python callback functions ("views"). The regular expressions
|
||||
use parenthesis to "capture" values from the URLs. When a user requests a page,
|
||||
Django runs through each pattern, in order, and stops at the first one that
|
||||
matches the requested URL. (If none of them matches, Django calls a
|
||||
special-case 404 view.) This is blazingly fast, because the regular expressions
|
||||
are compiled at load time.
|
||||
|
||||
Once one of the regexes matches, Django imports and calls the given view, which
|
||||
is a simple Python function. Each view gets passed a request object --
|
||||
|
|
|
@ -34,9 +34,9 @@ projects and ready to publish for others to install and use.
|
|||
|
||||
.. admonition:: Package? App?
|
||||
|
||||
A Python `package <https://docs.python.org/tutorial/modules.html#packages>`_
|
||||
provides a way of grouping related Python code for easy reuse. A package
|
||||
contains one or more files of Python code (also known as "modules").
|
||||
A Python :term:`package` provides a way of grouping related Python code for
|
||||
easy reuse. A package contains one or more files of Python code (also known
|
||||
as "modules").
|
||||
|
||||
A package can be imported with ``import foo.bar`` or ``from foo import
|
||||
bar``. For a directory (like ``polls``) to form a package, it must contain
|
||||
|
|
|
@ -102,8 +102,8 @@ These files are:
|
|||
anything inside it (e.g. ``mysite.urls``).
|
||||
|
||||
* :file:`mysite/__init__.py`: An empty file that tells Python that this
|
||||
directory should be considered a Python package. (Read `more about
|
||||
packages`_ in the official Python docs if you're a Python beginner.)
|
||||
directory should be considered a Python package. If you're a Python beginner,
|
||||
read :ref:`more about packages <tut-packages>` in the official Python docs.
|
||||
|
||||
* :file:`mysite/settings.py`: Settings/configuration for this Django
|
||||
project. :doc:`/topics/settings` will tell you all about how settings
|
||||
|
@ -116,8 +116,6 @@ These files are:
|
|||
* :file:`mysite/wsgi.py`: An entry-point for WSGI-compatible web servers to
|
||||
serve your project. See :doc:`/howto/deployment/wsgi/index` for more details.
|
||||
|
||||
.. _more about packages: https://docs.python.org/tutorial/modules.html#packages
|
||||
|
||||
The development server
|
||||
======================
|
||||
|
||||
|
@ -211,9 +209,10 @@ rather than creating directories.
|
|||
configuration and apps for a particular website. A project can contain
|
||||
multiple apps. An app can be in multiple projects.
|
||||
|
||||
Your apps can live anywhere on your `Python path`_. In this tutorial, we'll
|
||||
create our poll app right next to your :file:`manage.py` file so that it can be
|
||||
imported as its own top-level module, rather than a submodule of ``mysite``.
|
||||
Your apps can live anywhere on your :ref:`Python path <tut-searchpath>`. In
|
||||
this tutorial, we'll create our poll app right next to your :file:`manage.py`
|
||||
file so that it can be imported as its own top-level module, rather than a
|
||||
submodule of ``mysite``.
|
||||
|
||||
To create your app, make sure you're in the same directory as :file:`manage.py`
|
||||
and type this command:
|
||||
|
@ -236,8 +235,6 @@ That'll create a directory :file:`polls`, which is laid out like this::
|
|||
|
||||
This directory structure will house the poll application.
|
||||
|
||||
.. _`Python path`: https://docs.python.org/tutorial/modules.html#the-module-search-path
|
||||
|
||||
Write your first view
|
||||
=====================
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue