urls.static_plugins() method, closes #1033

Also documented how to package static assets and templates in plugins, closes #575
This commit is contained in:
Simon Willison 2020-10-24 13:03:40 -07:00
commit 10c35bd371
4 changed files with 67 additions and 5 deletions

View file

@ -387,6 +387,14 @@ The ``datasette.urls`` object contains methods for building URLs to pages within
``datasette.urls.logout()``
Returns the URL to the logout page, usually ``"/-/logout"``.
``datasette.urls.static(path)``
Returns the URL of one of Datasette's default static assets, for example ``"/-/static/app.css"``.
``datasette.urls.static_plugins(plugin_name, path)``
Returns the URL of one of the static assets belonging to a plugin.
``datasette.url.static_plugins("datasette_cluster_map", "datasette-cluster-map.js")`` would return ``"/-/static-plugins/datasette_cluster_map/datasette-cluster-map.js"``.
``datasette.urls.database(database_name)``
Returns the URL to a database page, for example ``"/fixtures"``