Python
iframe 에 Jupyter notebook 넣기
bryan.oh
2023. 3. 27. 19:49
반응형
Jupyter Notebook 띄워서 iframe 에 넣기
내 서비스 페이지에 Jupyter Notebook 을 iframe으로 붙히려면,
아래와 같이 <iframe> tag 를 쓰면 됩니다.
..생략..
</b-card>
<iframe src="http://localhost:8888/" width="100%" height="500px"></iframe>
</div>
..생략..
하지만 아래와 같이 오류가 발생합니다.
Jupyter 의 설정을 바꿔줍니다.
vi ~/.jupyter/jupyter_notebook_config.py
아래 설정이 있는 부분을 찾습니다.
/ 누르고 tornado_settings 이력하고 n 을 누르면 검색이 됩니다.
jupyter notebook을 포함할 domain, ip 를 아래에 입력합니다.
c.NotebookApp.tornado_settings = {
'headers': {
'Content-Security-Policy': 'frame-ancestors self http://localhost:9000',
}
}
localhost:9000 이라는 곳에서는 frame-ancestors 를 허용한다는 뜻
그리고 Jupyter Notebook을 다시 실행하고
localhost:9000 의 어떤 페이지에서든 포함시키면 됩니다.
<iframe src="http://localhost:8888/" width="100%" height="500px"></iframe>
이상.
728x90
반응형