update readme, make path generic
This commit is contained in:
parent
eaa7a5d55a
commit
8536aa0132
2 changed files with 12 additions and 1 deletions
|
@ -3,6 +3,13 @@ Open a site in a widget, or add a set of "quicklinks".
|
|||
|
||||

|
||||
|
||||
## Install
|
||||
```bash
|
||||
pip install jupyterlab_iframe
|
||||
jupyter labextension install jupyterlab_iframe
|
||||
jupyter serverextension enable --py jupyterlab_iframe
|
||||
```
|
||||
|
||||
## Adding quicklinks
|
||||
install the server extension, and add the following to `jupyter_notebook_config.py`
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import ujson
|
||||
from notebook.base.handlers import IPythonHandler
|
||||
from notebook.utils import url_path_join
|
||||
|
||||
|
||||
class IFrameHandler(IPythonHandler):
|
||||
|
@ -20,6 +21,9 @@ def load_jupyter_server_extension(nb_server_app):
|
|||
web_app = nb_server_app.web_app
|
||||
iframes = nb_server_app.config.get('JupyterLabIFrame', {}).get('iframes', [])
|
||||
host_pattern = '.*$'
|
||||
base_url = web_app.settings['base_url']
|
||||
|
||||
print('Installing jupyterlab_iframe handler on path %s' % '/iframes')
|
||||
print('Handinling iframes: %s' % iframes)
|
||||
web_app.add_handlers(host_pattern, [('/iframes', IFrameHandler, {'iframes': iframes})])
|
||||
|
||||
web_app.add_handlers(host_pattern, [(url_path_join(base_url, '/iframes'), IFrameHandler, {'iframes': iframes})])
|
||||
|
|
Loading…
Add table
Reference in a new issue