我正在编写一个 Jupyter 服务器扩展,将笔记本转换为 Web API。它在本地计算机上运行良好。我在部署到免费的天蓝色笔记本时遇到一些问题。我无法弄清楚 url 模式或我的服务器扩展未加载。
我已在 Azure Notebooks 终端中安装了适用于 python2.7 的包,而内核配置为使用 python 3.xx。命令:
pip27 安装 jupyterexcel --user jupyter serverextension启用--py jupyterexcel
我可以使用
看到扩展程序已启用jupyter 服务器扩展列表
我的问题是当我启动笔记本时:
https://jupyterexcel-luozhijian.notebooks.azure.com/j/notebooks/TestingJupyter.ipynb
我不知道如何让服务器扩展 url 模式发挥作用。 在我的本地计算机中,我可以使用:
http://localhost:8888/Excel/TestingJupyter.ipynb?token=ABCD&functionname=sum&1=11&2=8&3=6
server_extension代码位于:
https://github.com/luozhijian/jupyterexcel/blob/master/jupyterexcel/server_extension.py
类 ExcelModeHandler(IPythonHandler): 经过 #这里有一些代码 def load_jupyter_server_extension(nbapp): web_app = nbapp.web_app 主机模式 = '.*$' Route_pattern = url_path_join(web_app.settings['base_url'], r'/Excel%s' % path_regex) web_app.add_handlers(host_pattern, [(route_pattern, ExcelModeHandler)])
如果我使用以下命令,它将不起作用:
https://jupyterexcel-luozhijian.notebooks.azure.com/Excel/j/notebooks/TestingJupyter.ipynb?token=ABCD&functionname=sum&1=11&2=8&3=6 说找不到页面。 我期望它返回 json:25.0
感谢您分享您的场景! Azure Notebooks 不支持 Jupyter 服务器扩展,但我们会将其添加到我们的待办事项中。如果我们能继续听到对此的要求并能够优先考虑此功能工作,我一定会更新。谢谢!