| 1 |
.. _introspection: |
| 2 |
|
| 3 |
Introspection |
| 4 |
============= |
| 5 |
|
| 6 |
Datasette includes some pages and JSON API endpoints for introspecting the current instance. These can be used to understand some of the internals of Datasette and to see how a particular instance has been configured. |
| 7 |
|
| 8 |
Each of these pages can be viewed in your browser. Add ``.json`` to the URL to get back the contents as JSON. |
| 9 |
|
| 10 |
.. _JsonDataView_metadata: |
| 11 |
|
| 12 |
/-/metadata |
| 13 |
----------- |
| 14 |
|
| 15 |
Shows the contents of the ``metadata.json`` file that was passed to ``datasette serve``, if any. `Metadata example <https://fivethirtyeight.datasettes.com/-/metadata>`_: |
| 16 |
|
| 17 |
.. code-block:: json |
| 18 |
|
| 19 |
{ |
| 20 |
"license": "CC Attribution 4.0 License", |
| 21 |
"license_url": "http://creativecommons.org/licenses/by/4.0/", |
| 22 |
"source": "fivethirtyeight/data on GitHub", |
| 23 |
"source_url": "https://github.com/fivethirtyeight/data", |
| 24 |
"title": "Five Thirty Eight", |
| 25 |
"databases": { |
| 26 |
|
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
.. _JsonDataView_versions: |
| 31 |
|
| 32 |
/-/versions |
| 33 |
----------- |
| 34 |
|
| 35 |
Shows the version of Datasette, Python and SQLite. `Versions example <https://latest.datasette.io/-/versions>`_: |
| 36 |
|
| 37 |
.. code-block:: json |
| 38 |
|
| 39 |
{ |
| 40 |
"datasette": { |
| 41 |
"version": "0.60" |
| 42 |
}, |
| 43 |
"python": { |
| 44 |
"full": "3.8.12 (default, Dec 21 2021, 10:45:09) \n[GCC 10.2.1 20210110]", |
| 45 |
"version": "3.8.12" |
| 46 |
}, |
| 47 |
"sqlite": { |
| 48 |
"extensions": { |
| 49 |
"json1": null |
| 50 |
}, |
| 51 |
"fts_versions": [ |
| 52 |
"FTS5", |
| 53 |
"FTS4", |
| 54 |
"FTS3" |
| 55 |
], |
| 56 |
"compile_options": [ |
| 57 |
"COMPILER=gcc-6.3.0 20170516", |
| 58 |
"ENABLE_FTS3", |
| 59 |
"ENABLE_FTS4", |
| 60 |
"ENABLE_FTS5", |
| 61 |
"ENABLE_JSON1", |
| 62 |
"ENABLE_RTREE", |
| 63 |
"THREADSAFE=1" |
| 64 |
], |
| 65 |
"version": "3.37.0" |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
.. _JsonDataView_plugins: |
| 70 |
|
| 71 |
/-/plugins |
| 72 |
---------- |
| 73 |
|
| 74 |
Shows a list of currently installed plugins and their versions. `Plugins example <https://san-francisco.datasettes.com/-/plugins>`_: |
| 75 |
|
| 76 |
.. code-block:: json |
| 77 |
|
| 78 |
[ |
| 79 |
{ |
| 80 |
"name": "datasette_cluster_map", |
| 81 |
"static": true, |
| 82 |
"templates": false, |
| 83 |
"version": "0.10", |
| 84 |
"hooks": ["extra_css_urls", "extra_js_urls", "extra_body_script"] |
| 85 |
} |
| 86 |
] |
| 87 |
|
| 88 |
Add ``?all=1`` to include details of the default plugins baked into Datasette. |
| 89 |
|
| 90 |
.. _JsonDataView_config: |
| 91 |
|
| 92 |
/-/settings |
| 93 |
----------- |
| 94 |
|
| 95 |
Shows the :ref:`settings` for this instance of Datasette. `Settings example <https://fivethirtyeight.datasettes.com/-/settings>`_: |
| 96 |
|
| 97 |
.. code-block:: json |
| 98 |
|
| 99 |
{ |
| 100 |
"default_facet_size": 30, |
| 101 |
"default_page_size": 100, |
| 102 |
"facet_suggest_time_limit_ms": 50, |
| 103 |
"facet_time_limit_ms": 1000, |
| 104 |
"max_returned_rows": 1000, |
| 105 |
"sql_time_limit_ms": 1000 |
| 106 |
} |
| 107 |
|
| 108 |
.. _JsonDataView_databases: |
| 109 |
|
| 110 |
/-/databases |
| 111 |
------------ |
| 112 |
|
| 113 |
Shows currently attached databases. `Databases example <https://latest.datasette.io/-/databases>`_: |
| 114 |
|
| 115 |
.. code-block:: json |
| 116 |
|
| 117 |
[ |
| 118 |
{ |
| 119 |
"hash": null, |
| 120 |
"is_memory": false, |
| 121 |
"is_mutable": true, |
| 122 |
"name": "fixtures", |
| 123 |
"path": "fixtures.db", |
| 124 |
"size": 225280 |
| 125 |
} |
| 126 |
] |
| 127 |
|
| 128 |
.. _JsonDataView_threads: |
| 129 |
|
| 130 |
/-/threads |
| 131 |
---------- |
| 132 |
|
| 133 |
Shows details of threads and ``asyncio`` tasks. `Threads example <https://latest.datasette.io/-/threads>`_: |
| 134 |
|
| 135 |
.. code-block:: json |
| 136 |
|
| 137 |
{ |
| 138 |
"num_threads": 2, |
| 139 |
"threads": [ |
| 140 |
{ |
| 141 |
"daemon": false, |
| 142 |
"ident": 4759197120, |
| 143 |
"name": "MainThread" |
| 144 |
}, |
| 145 |
{ |
| 146 |
"daemon": true, |
| 147 |
"ident": 123145319682048, |
| 148 |
"name": "Thread-1" |
| 149 |
}, |
| 150 |
], |
| 151 |
"num_tasks": 3, |
| 152 |
"tasks": [ |
| 153 |
"<Task pending coro=<RequestResponseCycle.run_asgi() running at uvicorn/protocols/http/httptools_impl.py:385> cb=[set.discard()]>", |
| 154 |
"<Task pending coro=<Server.serve() running at uvicorn/main.py:361> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x10365c3d0>()]> cb=[run_until_complete.<locals>.<lambda>()]>", |
| 155 |
"<Task pending coro=<LifespanOn.main() running at uvicorn/lifespan/on.py:48> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x10364f050>()]>>" |
| 156 |
] |
| 157 |
} |
| 158 |
|
| 159 |
.. _JsonDataView_actor: |
| 160 |
|
| 161 |
/-/actor |
| 162 |
-------- |
| 163 |
|
| 164 |
Shows the currently authenticated actor. Useful for debugging Datasette authentication plugins. |
| 165 |
|
| 166 |
.. code-block:: json |
| 167 |
|
| 168 |
{ |
| 169 |
"actor": { |
| 170 |
"id": 1, |
| 171 |
"username": "some-user" |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
.. _MessagesDebugView: |
| 177 |
|
| 178 |
/-/messages |
| 179 |
----------- |
| 180 |
|
| 181 |
The debug tool at ``/-/messages`` can be used to set flash messages to try out that feature. See :ref:`datasette_add_message` for details of this feature. |