IPython:为所有请求配置基本URL路径

Dav*_*ams 8 python ipython

我试图弄清楚如何配置运行的IPython笔记本服务器的基本URL.而不是默认值:

#request# GET http://localhost:8888/static/tree/js/main.min.js?v=04a28c5e21950738efb217191f08ac33
#request# GET http://localhost:8888/api/terminals?_=1441754529652
#request# GET http://localhost:8888/custom/custom.js?v=20150908160654
#request# GET http://localhost:8888/notebooks/Untitled1.ipynb?kernel_name=python3#
Run Code Online (Sandbox Code Playgroud)

我想配置所有请求,以便通过ipython,如:

#request# GET http://localhost:8888/ipython/static/tree/js/main.min.js?v=04a28c5e21950738efb217191f08ac33
#request# GET http://localhost:8888/ipython/api/terminals?_=1441754529652
#request# GET http://localhost:8888/ipython/custom/custom.js?v=20150908160654
#request# GET http://localhost:8888/ipython/notebooks/Untitled1.ipynb?kernel_name=python3#
Run Code Online (Sandbox Code Playgroud)

这可能吗?

Max*_*ter 5

要更改从iPython提供的文件的基本URL,请在目录中编辑该ipython_notebook_config.py文件~/.ipython/[profile-name]/

特别是,假设您的配置文件以line开头c = get_config(),您将需要在配置中添加以下几行:

c.NotebookApp.base_project_url = '/ipython/'
c.NotebookApp.base_kernel_url = '/ipython/'
c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}
Run Code Online (Sandbox Code Playgroud)

这样可以使您的项目从而http://localhost:8888/ipython/不是从交付http://localhost:8888/

有关更多信息,请参见ipython docs的本页