mirror of https://github.com/django/django.git
Used :pypi: role in docs where appropriate.
This commit is contained in:
parent
7f8d839722
commit
304d256674
|
@ -154,7 +154,8 @@ Origin API and 3rd-party integration
|
|||
Django templates have an :class:`~django.template.base.Origin` object available
|
||||
through the ``template.origin`` attribute. This enables debug information to be
|
||||
displayed in the :ref:`template postmortem <template-postmortem>`, as well as
|
||||
in 3rd-party libraries, like the `Django Debug Toolbar`_.
|
||||
in 3rd-party libraries, like the :pypi:`Django Debug Toolbar
|
||||
<django-debug-toolbar>`.
|
||||
|
||||
Custom engines can provide their own ``template.origin`` information by
|
||||
creating an object that specifies the following attributes:
|
||||
|
@ -168,4 +169,3 @@ creating an object that specifies the following attributes:
|
|||
to load the template, e.g. ``django.template.loaders.filesystem.Loader``.
|
||||
|
||||
.. _DEP 182: https://github.com/django/deps/blob/main/final/0182-multiple-template-engines.rst
|
||||
.. _Django Debug Toolbar: https://github.com/jazzband/django-debug-toolbar/
|
||||
|
|
|
@ -35,8 +35,8 @@ with them.
|
|||
Python style
|
||||
============
|
||||
|
||||
* All files should be formatted using the `black`_ auto-formatter. This will be
|
||||
run by ``pre-commit`` if that is configured.
|
||||
* All files should be formatted using the :pypi:`black` auto-formatter. This
|
||||
will be run by ``pre-commit`` if that is configured.
|
||||
|
||||
* The project repository includes an ``.editorconfig`` file. We recommend using
|
||||
a text editor with `EditorConfig`_ support to avoid indentation and
|
||||
|
@ -506,5 +506,4 @@ JavaScript style
|
|||
For details about the JavaScript code style used by Django, see
|
||||
:doc:`javascript`.
|
||||
|
||||
.. _black: https://black.readthedocs.io/en/stable/
|
||||
.. _editorconfig: https://editorconfig.org/
|
||||
|
|
|
@ -8,10 +8,10 @@ Django's strengths is the rich ecosystem of third-party packages. They're
|
|||
community developed packages that can be used to quickly improve the feature set
|
||||
of an application.
|
||||
|
||||
This tutorial will show how to add `Django Debug Toolbar
|
||||
<https://django-debug-toolbar.readthedocs.io>`_, a commonly used third-party
|
||||
package. The Django Debug Toolbar has ranked in the top three most used
|
||||
third-party packages in the Django Developers Survey in recent years.
|
||||
This tutorial will show how to add :pypi:`Django Debug Toolbar
|
||||
<django-debug-toolbar>`, a commonly used third-party package. The Django Debug
|
||||
Toolbar has ranked in the top three most used third-party packages in the
|
||||
Django Developers Survey in recent years.
|
||||
|
||||
.. admonition:: Where to get help:
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ Geolocation with GeoIP2
|
|||
.. module:: django.contrib.gis.geoip2
|
||||
:synopsis: Python interface for MaxMind's GeoIP2 databases.
|
||||
|
||||
The :class:`GeoIP2` object is a wrapper for the `MaxMind geoip2 Python
|
||||
library`__. [#]_
|
||||
The :class:`GeoIP2` object is a wrapper for the :pypi:`MaxMind geoip2 Python
|
||||
library <geoip2>`. [#]_
|
||||
|
||||
In order to perform IP-based geolocation, the :class:`GeoIP2` object requires
|
||||
the :pypi:`geoip2` Python package and the GeoIP ``Country`` and/or ``City``
|
||||
|
@ -18,7 +18,6 @@ the :setting:`GEOIP_PATH` setting.
|
|||
Additionally, it is recommended to install the `libmaxminddb C library`__, so
|
||||
that ``geoip2`` can leverage the C library's faster speed.
|
||||
|
||||
__ https://geoip2.readthedocs.io/
|
||||
__ https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
|
||||
__ https://db-ip.com/db/lite.php
|
||||
__ https://github.com/maxmind/libmaxminddb/
|
||||
|
|
|
@ -801,11 +801,11 @@ For each field, we describe the default widget used if you don't specify
|
|||
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``,
|
||||
``invalid_image``
|
||||
|
||||
Using an ``ImageField`` requires that `Pillow`_ is installed with support
|
||||
for the image formats you use. If you encounter a ``corrupt image`` error
|
||||
when you upload an image, it usually means that Pillow doesn't understand
|
||||
its format. To fix this, install the appropriate library and reinstall
|
||||
Pillow.
|
||||
Using an ``ImageField`` requires that :pypi:`pillow` is installed with
|
||||
support for the image formats you use. If you encounter a ``corrupt image``
|
||||
error when you upload an image, it usually means that Pillow doesn't
|
||||
understand its format. To fix this, install the appropriate library and
|
||||
reinstall Pillow.
|
||||
|
||||
When you use an ``ImageField`` on a form, you must also remember to
|
||||
:ref:`bind the file data to the form <binding-uploaded-files>`.
|
||||
|
@ -851,7 +851,6 @@ For each field, we describe the default widget used if you don't specify
|
|||
image's content type if Pillow can determine it, otherwise it will be set
|
||||
to ``None``.
|
||||
|
||||
.. _Pillow: https://pillow.readthedocs.io/en/latest/
|
||||
.. _Image: https://pillow.readthedocs.io/en/latest/reference/Image.html
|
||||
|
||||
``IntegerField``
|
||||
|
|
|
@ -12,8 +12,8 @@ This document contains all the API references of :class:`Field` including the
|
|||
|
||||
.. seealso::
|
||||
|
||||
If the built-in fields don't do the trick, you can try `django-localflavor
|
||||
<https://github.com/django/django-localflavor>`_ (`documentation
|
||||
If the built-in fields don't do the trick, you can try
|
||||
:pypi:`django-localflavor` (`documentation
|
||||
<https://django-localflavor.readthedocs.io/>`_), which contains assorted
|
||||
pieces of code that are useful for particular countries and cultures.
|
||||
|
||||
|
@ -1357,9 +1357,7 @@ following optional arguments:
|
|||
Name of a model field which is auto-populated with the width of the image
|
||||
each time an image object is set.
|
||||
|
||||
Requires the `Pillow`_ library.
|
||||
|
||||
.. _Pillow: https://pillow.readthedocs.io/en/latest/
|
||||
Requires the :pypi:`pillow` library.
|
||||
|
||||
:class:`ImageField` instances are created in your database as ``varchar``
|
||||
columns with a default max length of 100 characters. As with other fields, you
|
||||
|
|
|
@ -14,7 +14,7 @@ As general programming practice, this goes without saying. Find out :ref:`what
|
|||
queries you are doing and what they are costing you <faq-see-raw-sql-queries>`.
|
||||
Use :meth:`.QuerySet.explain` to understand how specific ``QuerySet``\s are
|
||||
executed by your database. You may also want to use an external project like
|
||||
django-debug-toolbar_, or a tool that monitors your database directly.
|
||||
:pypi:`django-debug-toolbar`, or a tool that monitors your database directly.
|
||||
|
||||
Remember that you may be optimizing for speed or memory or both, depending on
|
||||
your requirements. Sometimes optimizing for one will be detrimental to the
|
||||
|
@ -30,8 +30,6 @@ readability of your code. **All** of the suggestions below come with the caveat
|
|||
that in your circumstances the general principle might not apply, or might even
|
||||
be reversed.
|
||||
|
||||
.. _django-debug-toolbar: https://github.com/jazzband/django-debug-toolbar/
|
||||
|
||||
Use standard DB optimization techniques
|
||||
=======================================
|
||||
|
||||
|
|
|
@ -774,7 +774,7 @@ to a file that can be inspected at your leisure.
|
|||
|
||||
Another approach is to use a "dumb" SMTP server that receives the emails
|
||||
locally and displays them to the terminal, but does not actually send
|
||||
anything. The `aiosmtpd`_ package provides a way to accomplish this:
|
||||
anything. The :pypi:`aiosmtpd` package provides a way to accomplish this:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
|
|
|
@ -1335,9 +1335,7 @@ whenever you restart your application server::
|
|||
|
||||
You can even pre-generate the JavaScript catalog as part of your deployment
|
||||
procedure and serve it as a static file. This radical technique is implemented
|
||||
in django-statici18n_.
|
||||
|
||||
.. _django-statici18n: https://django-statici18n.readthedocs.io/
|
||||
in :pypi:`django-statici18n`.
|
||||
|
||||
.. _url-internationalization:
|
||||
|
||||
|
|
|
@ -55,11 +55,10 @@ code.
|
|||
Django tools
|
||||
~~~~~~~~~~~~
|
||||
|
||||
`django-debug-toolbar
|
||||
<https://github.com/jazzband/django-debug-toolbar/>`_ is a very handy tool that
|
||||
provides insights into what your code is doing and how much time it spends
|
||||
doing it. In particular it can show you all the SQL queries your page is
|
||||
generating, and how long each one has taken.
|
||||
:pypi:`django-debug-toolbar` is a very handy tool that provides insights into
|
||||
what your code is doing and how much time it spends doing it. In particular it
|
||||
can show you all the SQL queries your page is generating, and how long each one
|
||||
has taken.
|
||||
|
||||
Third-party panels are also available for the toolbar, that can (for example)
|
||||
report on cache performance and template rendering times.
|
||||
|
|
Loading…
Reference in New Issue