python - nbviewer - 无法服务器本地文件
问题描述
我的问题与这个问题非常相似:我正在尝试在本地 nbviewer 服务器上提供本地文件。
/home/user/nbviewer/nbviewer/
我在启动 nbviewer 的远程服务器上安装了/home/user/
nbviewer
[servername]$ python -m nbviewer --debug --no-cache --no-check-certificate --localfiles=/home/user/path/to/notebooks/
这显示了远程服务器上的以下 nbviewer 输出
[I 181122 16:39:17 app:124] Not indexing notebooks
[I 181122 16:39:17 app:128] Not using cache
[I 181122 16:39:17 app:212] Not validating SSL certificates
[W 181122 16:39:17 app:263] Serving local notebooks in /home/user/path/to/notebooks/, this can be a security risk
现在我尝试为笔记本提供服务/home/user/path/to/notebooks/test.ipynb
,因此在本地计算机上的浏览器中输入网址
http://servername:5000/localfile/test.ipynb
这给出了 404 错误
[W 181122 16:51:40 log:53] 404 GET /localfile/test.ipynb
正如链接答案中所建议的,我也尝试访问
http://servername:5000/localfile/
查看提供的文件列表,但我再次收到 404 错误。
谢谢您的帮助!
解决方案
调试后nbviewer/nbviewer/providers/local/handlers.py
,我看到如果 nbviewer 没有文件的读取权限,它会发送 404 错误。在我看来应该是 401 Unauthorized 错误,但无论如何,在更改我想要托管的文件的权限后,它起作用了
推荐阅读
- javascript - 如何使用 selenium 迭代网站搜索结果?
- javascript - 反应材质UI
在 react-beautiful-dnd Draggable 中拖动时卡住了? - spring - 了解 JHipster 的安全机制:何时使用 JWT、HTTP Session 或 OAuth2 和 OpenID Connect?
- go - Go 函数声明真的不清楚输出是什么
- c++ - 将变量传递给具有多重继承的构造函数
- assembly - 除法错误-溢出,要手动处理此错误,请更改中断向量表中INT 0的地址
- c# - 如何使用 C# 获取域打印机列表(甚至未安装在系统中)
- ruby-on-rails - “由于可能的配置错误,请求超出了 10 个内部重定向的限制”,而 WordPress 在反向代理后面
- python - python - “类型”对象不可下标错误
- docker - SSH 进入以非 root 用户运行的 Azure Web 应用容器