mirror of
https://github.com/django/django.git
synced 2025-01-03 06:55:47 +00:00
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
|
Django templates have an :class:`~django.template.base.Origin` object available
|
||||||
through the ``template.origin`` attribute. This enables debug information to be
|
through the ``template.origin`` attribute. This enables debug information to be
|
||||||
displayed in the :ref:`template postmortem <template-postmortem>`, as well as
|
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
|
Custom engines can provide their own ``template.origin`` information by
|
||||||
creating an object that specifies the following attributes:
|
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``.
|
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
|
.. _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
|
Python style
|
||||||
============
|
============
|
||||||
|
|
||||||
* All files should be formatted using the `black`_ auto-formatter. This will be
|
* All files should be formatted using the :pypi:`black` auto-formatter. This
|
||||||
run by ``pre-commit`` if that is configured.
|
will be run by ``pre-commit`` if that is configured.
|
||||||
|
|
||||||
* The project repository includes an ``.editorconfig`` file. We recommend using
|
* The project repository includes an ``.editorconfig`` file. We recommend using
|
||||||
a text editor with `EditorConfig`_ support to avoid indentation and
|
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
|
For details about the JavaScript code style used by Django, see
|
||||||
:doc:`javascript`.
|
:doc:`javascript`.
|
||||||
|
|
||||||
.. _black: https://black.readthedocs.io/en/stable/
|
|
||||||
.. _editorconfig: https://editorconfig.org/
|
.. _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
|
community developed packages that can be used to quickly improve the feature set
|
||||||
of an application.
|
of an application.
|
||||||
|
|
||||||
This tutorial will show how to add `Django Debug Toolbar
|
This tutorial will show how to add :pypi:`Django Debug Toolbar
|
||||||
<https://django-debug-toolbar.readthedocs.io>`_, a commonly used third-party
|
<django-debug-toolbar>`, a commonly used third-party package. The Django Debug
|
||||||
package. The Django Debug Toolbar has ranked in the top three most used
|
Toolbar has ranked in the top three most used third-party packages in the
|
||||||
third-party packages in the Django Developers Survey in recent years.
|
Django Developers Survey in recent years.
|
||||||
|
|
||||||
.. admonition:: Where to get help:
|
.. admonition:: Where to get help:
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ Geolocation with GeoIP2
|
|||||||
.. module:: django.contrib.gis.geoip2
|
.. module:: django.contrib.gis.geoip2
|
||||||
:synopsis: Python interface for MaxMind's GeoIP2 databases.
|
:synopsis: Python interface for MaxMind's GeoIP2 databases.
|
||||||
|
|
||||||
The :class:`GeoIP2` object is a wrapper for the `MaxMind geoip2 Python
|
The :class:`GeoIP2` object is a wrapper for the :pypi:`MaxMind geoip2 Python
|
||||||
library`__. [#]_
|
library <geoip2>`. [#]_
|
||||||
|
|
||||||
In order to perform IP-based geolocation, the :class:`GeoIP2` object requires
|
In order to perform IP-based geolocation, the :class:`GeoIP2` object requires
|
||||||
the :pypi:`geoip2` Python package and the GeoIP ``Country`` and/or ``City``
|
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
|
Additionally, it is recommended to install the `libmaxminddb C library`__, so
|
||||||
that ``geoip2`` can leverage the C library's faster speed.
|
that ``geoip2`` can leverage the C library's faster speed.
|
||||||
|
|
||||||
__ https://geoip2.readthedocs.io/
|
|
||||||
__ https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
|
__ https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
|
||||||
__ https://db-ip.com/db/lite.php
|
__ https://db-ip.com/db/lite.php
|
||||||
__ https://github.com/maxmind/libmaxminddb/
|
__ 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``,
|
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``,
|
||||||
``invalid_image``
|
``invalid_image``
|
||||||
|
|
||||||
Using an ``ImageField`` requires that `Pillow`_ is installed with support
|
Using an ``ImageField`` requires that :pypi:`pillow` is installed with
|
||||||
for the image formats you use. If you encounter a ``corrupt image`` error
|
support for the image formats you use. If you encounter a ``corrupt image``
|
||||||
when you upload an image, it usually means that Pillow doesn't understand
|
error when you upload an image, it usually means that Pillow doesn't
|
||||||
its format. To fix this, install the appropriate library and reinstall
|
understand its format. To fix this, install the appropriate library and
|
||||||
Pillow.
|
reinstall Pillow.
|
||||||
|
|
||||||
When you use an ``ImageField`` on a form, you must also remember to
|
When you use an ``ImageField`` on a form, you must also remember to
|
||||||
:ref:`bind the file data to the form <binding-uploaded-files>`.
|
: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
|
image's content type if Pillow can determine it, otherwise it will be set
|
||||||
to ``None``.
|
to ``None``.
|
||||||
|
|
||||||
.. _Pillow: https://pillow.readthedocs.io/en/latest/
|
|
||||||
.. _Image: https://pillow.readthedocs.io/en/latest/reference/Image.html
|
.. _Image: https://pillow.readthedocs.io/en/latest/reference/Image.html
|
||||||
|
|
||||||
``IntegerField``
|
``IntegerField``
|
||||||
|
@ -12,8 +12,8 @@ This document contains all the API references of :class:`Field` including the
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
If the built-in fields don't do the trick, you can try `django-localflavor
|
If the built-in fields don't do the trick, you can try
|
||||||
<https://github.com/django/django-localflavor>`_ (`documentation
|
:pypi:`django-localflavor` (`documentation
|
||||||
<https://django-localflavor.readthedocs.io/>`_), which contains assorted
|
<https://django-localflavor.readthedocs.io/>`_), which contains assorted
|
||||||
pieces of code that are useful for particular countries and cultures.
|
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
|
Name of a model field which is auto-populated with the width of the image
|
||||||
each time an image object is set.
|
each time an image object is set.
|
||||||
|
|
||||||
Requires the `Pillow`_ library.
|
Requires the :pypi:`pillow` library.
|
||||||
|
|
||||||
.. _Pillow: https://pillow.readthedocs.io/en/latest/
|
|
||||||
|
|
||||||
:class:`ImageField` instances are created in your database as ``varchar``
|
:class:`ImageField` instances are created in your database as ``varchar``
|
||||||
columns with a default max length of 100 characters. As with other fields, you
|
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>`.
|
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
|
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
|
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
|
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
|
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
|
that in your circumstances the general principle might not apply, or might even
|
||||||
be reversed.
|
be reversed.
|
||||||
|
|
||||||
.. _django-debug-toolbar: https://github.com/jazzband/django-debug-toolbar/
|
|
||||||
|
|
||||||
Use standard DB optimization techniques
|
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
|
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
|
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
|
.. 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
|
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
|
procedure and serve it as a static file. This radical technique is implemented
|
||||||
in django-statici18n_.
|
in :pypi:`django-statici18n`.
|
||||||
|
|
||||||
.. _django-statici18n: https://django-statici18n.readthedocs.io/
|
|
||||||
|
|
||||||
.. _url-internationalization:
|
.. _url-internationalization:
|
||||||
|
|
||||||
|
@ -55,11 +55,10 @@ code.
|
|||||||
Django tools
|
Django tools
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
`django-debug-toolbar
|
:pypi:`django-debug-toolbar` is a very handy tool that provides insights into
|
||||||
<https://github.com/jazzband/django-debug-toolbar/>`_ is a very handy tool that
|
what your code is doing and how much time it spends doing it. In particular it
|
||||||
provides insights into what your code is doing and how much time it spends
|
can show you all the SQL queries your page is generating, and how long each one
|
||||||
doing it. In particular it can show you all the SQL queries your page is
|
has taken.
|
||||||
generating, and how long each one has taken.
|
|
||||||
|
|
||||||
Third-party panels are also available for the toolbar, that can (for example)
|
Third-party panels are also available for the toolbar, that can (for example)
|
||||||
report on cache performance and template rendering times.
|
report on cache performance and template rendering times.
|
||||||
|
Loading…
Reference in New Issue
Block a user