kopia lustrzana https://github.com/simonw/datasette
Fixed some broken internal links, refs #1106
rodzic
bbde835a1f
commit
50cc6af016
|
@ -353,9 +353,9 @@ Signed values and secrets
|
|||
|
||||
Both flash messages and user authentication needed a way to sign values and set signed cookies. Two new methods are now available for plugins to take advantage of this mechanism: :ref:`datasette_sign` and :ref:`datasette_unsign`.
|
||||
|
||||
Datasette will generate a secret automatically when it starts up, but to avoid resetting the secret (and hence invalidating any cookies) every time the server restarts you should set your own secret. You can pass a secret to Datasette using the new ``--secret`` option or with a ``DATASETTE_SECRET`` environment variable. See :ref:`settings_secret` for more details.
|
||||
Datasette will generate a secret automatically when it starts up, but to avoid resetting the secret (and hence invalidating any cookies) every time the server restarts you should set your own secret. You can pass a secret to Datasette using the new ``--secret`` option or with a ``DATASETTE_SECRET`` environment variable. See :ref:`setting_secret` for more details.
|
||||
|
||||
You can also set a secret when you deploy Datasette using ``datasette publish`` or ``datasette package`` - see :ref:`settings_publish_secrets`.
|
||||
You can also set a secret when you deploy Datasette using ``datasette publish`` or ``datasette package`` - see :ref:`setting_publish_secrets`.
|
||||
|
||||
Plugins can now sign values and verify their signatures using the :ref:`datasette.sign() <datasette_sign>` and :ref:`datasette.unsign() <datasette_unsign>` methods.
|
||||
|
||||
|
@ -450,7 +450,7 @@ A small release which provides improved internal methods for use in plugins, alo
|
|||
|
||||
You can now create :ref:`custom pages <custom_pages>` within your Datasette instance using a custom template file. For example, adding a template file called ``templates/pages/about.html`` will result in a new page being served at ``/about`` on your instance. See the :ref:`custom pages documentation <custom_pages>` for full details, including how to return custom HTTP headers, redirects and status codes. (`#648 <https://github.com/simonw/datasette/issues/648>`__)
|
||||
|
||||
:ref:`settings_dir` (`#731 <https://github.com/simonw/datasette/issues/731>`__) allows you to define a custom Datasette instance as a directory. So instead of running the following::
|
||||
:ref:`config_dir` (`#731 <https://github.com/simonw/datasette/issues/731>`__) allows you to define a custom Datasette instance as a directory. So instead of running the following::
|
||||
|
||||
$ datasette one.db two.db \
|
||||
--metadata=metadata.json \
|
||||
|
@ -480,7 +480,7 @@ Also in this release:
|
|||
* Datasette :ref:`metadata` can now be provided as a YAML file as an optional alternative to JSON. See :ref:`metadata_yaml`. (`#713 <https://github.com/simonw/datasette/issues/713>`__)
|
||||
* Removed support for ``datasette publish now``, which used the the now-retired Zeit Now v1 hosting platform. A new plugin, `datasette-publish-now <https://github.com/simonw/datasette-publish-now>`__, can be installed to publish data to Zeit (`now Vercel <https://vercel.com/blog/zeit-is-now-vercel>`__) Now v2. (`#710 <https://github.com/simonw/datasette/issues/710>`__)
|
||||
* Fixed a bug where the ``extra_template_vars(request, view_name)`` plugin hook was not receiving the correct ``view_name``. (`#716 <https://github.com/simonw/datasette/issues/716>`__)
|
||||
* Variables added to the template context by the ``extra_template_vars()`` plugin hook are now shown in the ``?_context=1`` debugging mode (see :ref:`settings_template_debug`). (`#693 <https://github.com/simonw/datasette/issues/693>`__)
|
||||
* Variables added to the template context by the ``extra_template_vars()`` plugin hook are now shown in the ``?_context=1`` debugging mode (see :ref:`setting_template_debug`). (`#693 <https://github.com/simonw/datasette/issues/693>`__)
|
||||
* Fixed a bug where the "templates considered" HTML comment was no longer being displayed. (`#689 <https://github.com/simonw/datasette/issues/689>`__)
|
||||
* Fixed a ``datasette publish`` bug where ``--plugin-secret`` would over-ride plugin configuration in the provided ``metadata.json`` file. (`#724 <https://github.com/simonw/datasette/issues/724>`__)
|
||||
* Added a new CSS class for customizing the canned query page. (`#727 <https://github.com/simonw/datasette/issues/727>`__)
|
||||
|
@ -565,7 +565,7 @@ Also in this release:
|
|||
* asyncio task information is now included on the ``/-/threads`` debug page
|
||||
* Bumped Uvicorn dependency 0.11
|
||||
* You can now use ``--port 0`` to listen on an available port
|
||||
* New :ref:`settings_template_debug` setting for debugging templates, e.g. https://latest.datasette.io/fixtures/roadside_attractions?_context=1 (`#654 <https://github.com/simonw/datasette/issues/654>`__)
|
||||
* New :ref:`setting_template_debug` setting for debugging templates, e.g. https://latest.datasette.io/fixtures/roadside_attractions?_context=1 (`#654 <https://github.com/simonw/datasette/issues/654>`__)
|
||||
|
||||
.. _v0_32:
|
||||
|
||||
|
@ -941,7 +941,7 @@ A number of small new features:
|
|||
|
||||
- ``datasette publish heroku`` now supports ``--extra-options``, fixes `#334 <https://github.com/simonw/datasette/issues/334>`_
|
||||
- Custom error message if SpatiaLite is needed for specified database, closes `#331 <https://github.com/simonw/datasette/issues/331>`_
|
||||
- New config option: ``truncate_cells_html`` for :ref:`truncating long cell values <config_truncate_cells_html>` in HTML view - closes `#330 <https://github.com/simonw/datasette/issues/330>`_
|
||||
- New config option: ``truncate_cells_html`` for :ref:`truncating long cell values <setting_truncate_cells_html>` in HTML view - closes `#330 <https://github.com/simonw/datasette/issues/330>`_
|
||||
- Documentation for :ref:`datasette publish and datasette package <publishing>`, closes `#337 <https://github.com/simonw/datasette/issues/337>`_
|
||||
- Fixed compatibility with Python 3.7
|
||||
- ``datasette publish heroku`` now supports app names via the ``-n`` option, which can also be used to overwrite an existing application [Russ Garrett]
|
||||
|
@ -1000,7 +1000,7 @@ Check out the :ref:`CSV export documentation <csv_export>` for more details, or
|
|||
try the feature out on
|
||||
https://fivethirtyeight.datasettes.com/fivethirtyeight/bechdel%2Fmovies
|
||||
|
||||
If your table has more than :ref:`settings_max_returned_rows` (default 1,000)
|
||||
If your table has more than :ref:`setting_max_returned_rows` (default 1,000)
|
||||
Datasette provides the option to *stream all rows*. This option takes advantage
|
||||
of async Python and Datasette's efficient :ref:`pagination <pagination>` to
|
||||
iterate through the entire matching result set and stream it back as a
|
||||
|
|
|
@ -23,7 +23,7 @@ file, which looks like this and has the following options:
|
|||
the ``city_id`` column is accompanied by a ``city_id_label`` column.
|
||||
|
||||
* **stream all rows** - by default CSV files only contain the first
|
||||
:ref:`settings_max_returned_rows` records. This option will cause Datasette to
|
||||
:ref:`setting_max_returned_rows` records. This option will cause Datasette to
|
||||
loop through every matching record and return them as a single CSV file.
|
||||
|
||||
You can try that out on https://latest.datasette.io/fixtures/facetable?_size=4
|
||||
|
@ -40,9 +40,9 @@ Since databases can get pretty large, by default this option is capped at 100MB
|
|||
if a table returns more than 100MB of data the last line of the CSV will be a
|
||||
truncation error message.
|
||||
|
||||
You can increase or remove this limit using the :ref:`settings_max_csv_mb` config
|
||||
You can increase or remove this limit using the :ref:`setting_max_csv_mb` config
|
||||
setting. You can also disable the CSV export feature entirely using
|
||||
:ref:`settings_allow_csv_stream`.
|
||||
:ref:`setting_allow_csv_stream`.
|
||||
|
||||
A note on URLs
|
||||
--------------
|
||||
|
|
|
@ -58,7 +58,7 @@ Add a random value for the ``DATASETTE_SECRET`` - this will be used to sign Data
|
|||
|
||||
$ python3 -c 'import secrets; print(secrets.token_hex(32))'
|
||||
|
||||
This configuration will run Datasette against all database files contained in the ``/home/ubunt/datasette-root`` directory. If that directory contains a ``metadata.yml`` (or ``.json``) file or a ``templates/`` or ``plugins/`` sub-directory those will automatically be loaded by Datasette - see :ref:`settings_dir` for details.
|
||||
This configuration will run Datasette against all database files contained in the ``/home/ubunt/datasette-root`` directory. If that directory contains a ``metadata.yml`` (or ``.json``) file or a ``templates/`` or ``plugins/`` sub-directory those will automatically be loaded by Datasette - see :ref:`config_dir` for details.
|
||||
|
||||
You can start the Datasette process running using the following::
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ Row
|
|||
|
||||
Every row in every Datasette table has its own URL. This means individual records can be linked to directly.
|
||||
|
||||
Table cells with extremely long text contents are truncated on the table view according to the :ref:`settings_truncate_cells_html` setting. If a cell has been truncated the full length version of that cell will be available on the row page.
|
||||
Table cells with extremely long text contents are truncated on the table view according to the :ref:`setting_truncate_cells_html` setting. If a cell has been truncated the full length version of that cell will be available on the row page.
|
||||
|
||||
Rows which are the targets of foreign key references from other tables will show a link to a filtered search for all records that reference that row. Here's an example from the Registers of Members Interests database:
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ Using a caching proxy in this way could enable a Datasette-backed visualization
|
|||
|
||||
Datasette's integration with HTTP caches can be enabled using a combination of configuration options and querystring arguments.
|
||||
|
||||
The :ref:`settings_default_cache_ttl` setting sets the default HTTP cache TTL for all Datasette pages. This is 5 seconds unless you change it - you can set it to 0 if you wish to disable HTTP caching entirely.
|
||||
The :ref:`setting_default_cache_ttl` setting sets the default HTTP cache TTL for all Datasette pages. This is 5 seconds unless you change it - you can set it to 0 if you wish to disable HTTP caching entirely.
|
||||
|
||||
You can also change the cache timeout on a per-request basis using the ``?_ttl=10`` querystring parameter. This can be useful when you are working with the Datasette JSON API - you may decide that a specific query can be cached for a longer time, or maybe you need to set ``?_ttl=0`` for some requests for example if you are running a SQL ``order by random()`` query.
|
||||
|
||||
|
@ -65,9 +65,9 @@ Hashed URL mode
|
|||
|
||||
When you open a database file in immutable mode using the ``-i`` option, Datasette calculates a SHA-256 hash of the contents of that file on startup. This content hash can then optionally be used to create URLs that are guaranteed to change if the contents of the file changes in the future. This results in URLs that can then be cached indefinitely by both browsers and caching proxies - an enormous potential performance optimization.
|
||||
|
||||
You can enable these hashed URLs in two ways: using the :ref:`settings_hash_urls` configuration setting (which affects all requests to Datasette) or via the ``?_hash=1`` querystring parameter (which only applies to the current request).
|
||||
You can enable these hashed URLs in two ways: using the :ref:`setting_hash_urls` configuration setting (which affects all requests to Datasette) or via the ``?_hash=1`` querystring parameter (which only applies to the current request).
|
||||
|
||||
With hashed URLs enabled, any request to e.g. ``/mydatabase/mytable`` will 302 redirect to ``mydatabase-455fe3a/mytable``. The URL containing the hash will be served with a very long cache expire header - configured using :ref:`settings_default_cache_ttl_hashed` which defaults to 365 days.
|
||||
With hashed URLs enabled, any request to e.g. ``/mydatabase/mytable`` will 302 redirect to ``mydatabase-455fe3a/mytable``. The URL containing the hash will be served with a very long cache expire header - configured using :ref:`setting_default_cache_ttl_hashed` which defaults to 365 days.
|
||||
|
||||
Since these responses are cached for a long time, you may wish to build API clients against the non-hashed version of these URLs. These 302 redirects are served extremely quickly, so this should still be a performant way to work against the Datasette API.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue