IPython: 为所有请求配置基本 Url 路径
IPython: Configure Base Url Path for All Request
我正在尝试弄清楚如何配置 url 和 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#
我想配置所有请求,以便通过 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#
这可能吗?
要更改从 iPython 提供的文件的基础 url,请编辑 ~/.ipython/[profile-name]/
目录中的 ipython_notebook_config.py
文件。
特别是,假设您的配置文件以行 c = get_config()
开头,您需要将以下行添加到您的配置中:
c.NotebookApp.base_project_url = '/ipython/'
c.NotebookApp.base_kernel_url = '/ipython/'
c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}
这将使您的项目从 http://localhost:8888/ipython/
而不是 http://localhost:8888/
提供。
有关详细信息,请参阅 this page of the ipython docs。
我正在尝试弄清楚如何配置 url 和 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#
我想配置所有请求,以便通过 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#
这可能吗?
要更改从 iPython 提供的文件的基础 url,请编辑 ~/.ipython/[profile-name]/
目录中的 ipython_notebook_config.py
文件。
特别是,假设您的配置文件以行 c = get_config()
开头,您需要将以下行添加到您的配置中:
c.NotebookApp.base_project_url = '/ipython/'
c.NotebookApp.base_kernel_url = '/ipython/'
c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}
这将使您的项目从 http://localhost:8888/ipython/
而不是 http://localhost:8888/
提供。
有关详细信息,请参阅 this page of the ipython docs。