如何在网页上嵌入Jupyter?

时间:2018-06-14 23:30:59

标签: python jupyter-notebook jupyter jupyterhub

我如何使用iframe在网页上嵌入Jupyter,live(未转换为HTML)?我们正在尝试将JupyterHub中的Jupyter笔记本嵌入到编程教程中。我相信我必须启用与CORS有关的东西?谢谢大家的时间。

1 个答案:

答案 0 :(得分:1)

您已将网页的url放在jupyterhub_config.py(jupyterhub的配置文件)和jupyter_notebook_config.py(笔记本的配置文件)的Content-Security-Policy中。

在jupyterhub_config.py

c.JupyterHub.tornado_settings = {
    'headers': {
        'Content-Security-Policy': "frame-ancestors 'self' http://<your-webpage-url>"
    }
}

在jupyter_notebook_config.py

c.NotebookApp.tornado_settings = {
    'headers': {
        'Content-Security-Policy': "frame-ancestors 'self' http://<your-webpage-url>:4200"
    }
}