Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datasette.urls.static_plugins(...) method #1033

Closed
simonw opened this issue Oct 20, 2020 · 5 comments
Closed

datasette.urls.static_plugins(...) method #1033

simonw opened this issue Oct 20, 2020 · 5 comments

Comments

@simonw
Copy link
Owner

simonw commented Oct 20, 2020

Follow-on from #904. For constructing URLs like this:

/-/static-plugins/NAME_OF_PLUGIN_PACKAGE/yourfile.js

Should be documented on https://docs.datasette.io/en/latest/writing_plugins.html#static-assets and https://docs.datasette.io/en/latest/internals.html#datasette-urls

@simonw
Copy link
Owner Author

simonw commented Oct 20, 2020

Also refs #1023

@psychemedia
Copy link
Contributor

How does /-/static relate to current guidance docs around static regarding the --static option and metadata formulations such as "extra_js_urls": [ "/static/app.js"] (I've not managed to get this to work in a Jupyter server proxied set up; the datasette / jupyter server proxy repo may provide a useful test example, eg via MyBinder, for folk to crib from?)

@simonw
Copy link
Owner Author

simonw commented Oct 22, 2020

That's a good question - I hadn't considered that. I'm going to open a new issue to have extra_js_urls respect the base_url setting, since the static files will be served from a different location.

@simonw
Copy link
Owner Author

simonw commented Oct 24, 2020

Documentation here: https://docs.datasette.io/en/latest/internals.html#datasette-urls

simonw added a commit that referenced this issue Oct 24, 2020
Also documented how to package static assets and templates in plugins, closes #575
@psychemedia
Copy link
Contributor

From the docs, I note:

datasette.urls.instance()
Returns the URL to the Datasette instance root page. This is usually "/"

What about the proxy case? Eg if I am using jupyter-server-proxy on a MyBinder or local Jupyter notebook server site, https://example.com:PORT/weirdpath/datasette, what does datasette.urls.instance() refer to?

  • https://example.com:PORT/weirdpath/datasette
  • https://example.com:PORT/weirdpath/
  • https://example.com:PORT/
  • https://example.com
  • something else?

simonw added a commit that referenced this issue Oct 30, 2020
simonw added a commit that referenced this issue Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants