1
我想我自己的代碼編輯器執行通過jupyter筆記本的代碼和具有顯示在我的web應用程序UI效果有沒有辦法整合Jupyter記事本到我的web應用程序
我想我自己的代碼編輯器執行通過jupyter筆記本的代碼和具有顯示在我的web應用程序UI效果有沒有辦法整合Jupyter記事本到我的web應用程序
最簡單的方法是嵌入整個在iframe
頁:
<iframe src="http://localhost:8888" />
一件事,應該指出的是,Jupyter筆記本默認情況下只允許從頁面同一產地通過在頭設置frame-ancestors將它嵌入:
'headers': {
'Content-Security-Policy': "frame-ancestors 'self'"
}
爲了將它嵌入到自己的應用程序,你需要在jupyter_notebook_config.py
覆蓋設置允許任何網頁中嵌入它:
c.NotebookApp.tornado_settings = {
'headers': {
'Content-Security-Policy': "frame-ancestors *"
}
}