Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPython: Configure Base Url Path for All Request

Tags:

python

ipython

I am trying to figure out how to configure the base url of and IPython notebook server running. So instead of the default:

#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#

I want to configure all requests so that the go through ipython, as in:

#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#

Is this possible?

like image 926
David Williams Avatar asked Sep 08 '15 23:09

David Williams


1 Answers

To change the base url for the files that are being served up from iPython, edit the ipython_notebook_config.py file in your ~/.ipython/[profile-name]/ directory.

In particular, assuming that your config file starts with the line c = get_config(), you will want to add the following lines to your configuration:

c.NotebookApp.base_project_url = '/ipython/'
c.NotebookApp.base_kernel_url = '/ipython/'
c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipython/static/'}

This will make it so that your project is served up from http://localhost:8888/ipython/ instead of http://localhost:8888/.

For more information please see this page of the ipython docs.

like image 94
Maximillian Laumeister Avatar answered Sep 22 '22 08:09

Maximillian Laumeister