python - 在远程服务器上运行时为 jupyter notebook 指定主机名
问题描述
我正在远程服务器上运行一个笔记本,我通过浏览器从本地计算机连接到该笔记本。我有一个小小的烦恼是它在开始时打印:
Serving notebooks from local directory: /home/xxxxxxx
0 active kernels
The Jupyter Notebook is running at:
http://(friendly or 127.0.0.1):8888/
friendly
主机的友好名称在哪里。主机的 FQDN 实际上是friendly.x.y.z.com
. 我希望它打印这个:
The Jupyter Notebook is running at:
http://friendly.x.y.z.com:8888/
以便可以从控制台直接单击 URL。是否有一个配置选项我可以在 jupyter notebook 中传递某个地方来明确指定我想要显示的主机名?
需要明确的是,http://friendly.x.y.z.com:8888/
尽管出现上述消息,但仍可在浏览器中正确解析。
解决方案
您应该首先生成配置文件:
jupyter notebook --generate-config
然后使用配置文件,您可以通过编辑配置文件 ~/.jupyter/jupyter_notebook_config.py 更改以下行来设置自定义 URL:
c.NotebookApp.custom_display_url = 'http://friendly.x.y.z.com:8888'
因此,当您启动服务器时,它将显示此 URL 与令牌连接。
推荐阅读
- python - adding an auth check to github webhooks using flask + python3
- perl - DBD::SQLcipher prepare 和 PRAGMA 都在工作
- vue.js - 我可以在 beforeCreate() 中定义一个变量吗?
- javascript - 变量值未保存在函数中
- javascript - 如何防止切换类在香草JS中进入页面顶部?
- java - 服务器抛出损坏的管道异常
- java - 如何为具有定义长度的十进制正则表达式(包括逗号)
- android - 如何知道是否创建了活动?
- c++ - 使用动态内存分配时的c ++分段错误和跟踪/断点陷阱
- c# - Chilkat 文件上传因套接字错误而失败