diff options
| author | Michael Merickel <michael@merickel.org> | 2019-12-23 14:07:56 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2019-12-23 14:07:56 -0600 |
| commit | e46d009954e89be393d748b9e97b1202ece3eafe (patch) | |
| tree | c1b2565b27da44efefdab57294f78025ebad53e1 /docs/narr | |
| parent | 570243fcf3f9bb7b3da78404b0598011791ac882 (diff) | |
| parent | 912dc539ca793959d7465995f906279dad21ccc9 (diff) | |
| download | pyramid-e46d009954e89be393d748b9e97b1202ece3eafe.tar.gz pyramid-e46d009954e89be393d748b9e97b1202ece3eafe.tar.bz2 pyramid-e46d009954e89be393d748b9e97b1202ece3eafe.zip | |
Merge branch 'master' into luhn-authenticated-userid
Diffstat (limited to 'docs/narr')
| -rw-r--r-- | docs/narr/assets.rst | 31 | ||||
| -rw-r--r-- | docs/narr/cookiecutters.rst | 2 | ||||
| -rw-r--r-- | docs/narr/install.rst | 6 | ||||
| -rw-r--r-- | docs/narr/logging.rst | 2 | ||||
| -rw-r--r-- | docs/narr/upgrading.rst | 6 |
5 files changed, 39 insertions, 8 deletions
diff --git a/docs/narr/assets.rst b/docs/narr/assets.rst index d1d64f0c3..f9d30563e 100644 --- a/docs/narr/assets.rst +++ b/docs/narr/assets.rst @@ -190,6 +190,37 @@ such a request. The :meth:`~pyramid.request.Request.static_url` API is discussed in more detail later in this chapter. .. index:: + single: pre-compressed assets + +.. _pre_compressed_assets: + +Serving Pre-compressed Assets +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.0 + +It's possible to configure :app:`Pyramid` to serve pre-compressed static assets. +This can greatly reduce the bandwidth required to serve assets - most modern browsers support ``gzip``, ``deflate``, and ``br`` (brotli) encoded responses. +A client declares support for encoded responses using the ``Accept-Encoding`` HTTP header. For example, ``Accept-Encoding: gzip, default, br``. +The response will then contain the pre-compressed content with the ``Content-Encoding`` header set to the matched encoding. +This feature assumes that the static assets exist unencoded (``identity`` encoding) as well as in zero or more encoded formats. +If the encoded version of a file is missing, or the client doesn't declare support for the encoded version, the unencoded version is returned instead. + +In order to configure this in your application, the first step is to compress your assets. +For example, update your static asset pipeline to export ``.gz`` versions of every file. +Second, add ``content_encodings=['gzip']`` when invoking :meth:`pyramid.config.Configurator.add_static_view`. + +The encoded file extensions are determined by :attr:`mimetypes.encodings_map`. +So, if your desired encoding is missing, you'll need to add it there: + +.. code-block:: python + + import mimetypes + mimetypes.encodings_map['.br'] = 'br' # add brotli + +It is not necessary for every file to support every encoding, but :app:`Pyramid` will not serve an encoding that is not declared. + +.. index:: single: generating static asset urls single: static asset urls pair: assets; generating urls diff --git a/docs/narr/cookiecutters.rst b/docs/narr/cookiecutters.rst index c6829056c..066d6c2e5 100644 --- a/docs/narr/cookiecutters.rst +++ b/docs/narr/cookiecutters.rst @@ -3,7 +3,7 @@ Pyramid cookiecutters ===================== -A :term:`cookiecutter` is a command-line utility that creates projects from :ref:`cookiecutters <cookiecutter:readme>` (project templates). +A :term:`cookiecutter` is a command-line utility that creates projects from `cookiecutters <https://cookiecutter.readthedocs.io/en/latest/>`__ (project templates). `pyramid-cookiecutter-starter <https://github.com/Pylons/pyramid-cookiecutter-starter>`_ diff --git a/docs/narr/install.rst b/docs/narr/install.rst index 268ae5f8d..8e2bfa866 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -5,7 +5,7 @@ Installing :app:`Pyramid` .. note:: - This installation guide emphasizes the use of Python 3.4 and greater for + This installation guide emphasizes the use of Python 3.5 and greater for simplicity. @@ -15,13 +15,13 @@ Installing :app:`Pyramid` Before You Install Pyramid -------------------------- -Install Python version 3.4 or greater for your operating system, and satisfy +Install Python version 3.5 or greater for your operating system, and satisfy the :ref:`requirements-for-installing-packages`, as described in the following sections. .. sidebar:: Python Versions - As of this writing, :app:`Pyramid` is tested against Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 (with allowed failures), and PyPy3. + As of this writing, :app:`Pyramid` is tested against Python 3.5, 3.6, Python 3.7, Python 3.8, and PyPy3. :app:`Pyramid` is known to run on all popular Unix-like systems such as Linux, macOS, and FreeBSD, as well as on Windows platforms. It is also known to diff --git a/docs/narr/logging.rst b/docs/narr/logging.rst index 58bd2d4ec..844128758 100644 --- a/docs/narr/logging.rst +++ b/docs/narr/logging.rst @@ -32,7 +32,7 @@ you to send messages to :mod:`Python standard library logging package :term:`PasteDeploy` ``development.ini`` and ``production.ini`` files created when you use our cookiecutter include a basic configuration for the Python :mod:`logging` package. -These ``.ini`` file sections are passed to the `logging module's config file configuration engine <https://docs.python.org/3.7/howto/logging.html#configuring-logging>`_. +These ``.ini`` file sections are passed to the `logging module's config file configuration engine <https://docs.python.org/3/howto/logging.html#configuring-logging>`_. PasteDeploy ``.ini`` files use the Python standard library :mod:`ConfigParser format <ConfigParser>`. This is the same format used as the Python diff --git a/docs/narr/upgrading.rst b/docs/narr/upgrading.rst index af552741c..31ca6adfa 100644 --- a/docs/narr/upgrading.rst +++ b/docs/narr/upgrading.rst @@ -86,10 +86,10 @@ At the time of a Pyramid version release, each supports all versions of Python through the end of their lifespans. The end-of-life for a given version of Python is when security updates are no longer released. -- `Python 3.4 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2019-03-16 . -- `Python 3.5 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2020-09-13 . +- `Python 3.5 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2020-09-13. - `Python 3.6 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2021-12-23. -- `Python 3.7 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2023-06-27 . +- `Python 3.7 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2023-06-27. +- `Python 3.8 Lifespan <https://devguide.python.org/#status-of-python-branches>`_ 2024-10-??. To determine the Python support for a specific release of Pyramid, view its ``tox.ini`` file at the root of the repository's version. |
