2015-09-08 1 views
8

Ich versuche herauszufinden, wie die Basis-URL und der IPython-Notebook-Server konfiguriert werden. So anstelle des Standard:IPython: Konfigurieren des Basis-URL-Pfads für alle Anforderung

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

Ich möchte alle Anfragen so konfigurieren, dass die durch ipython gehen, wie 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# 

Ist das möglich?

+0

naja ... was ist der Unterschied zwischen erstem Code und zweitem? – felipsmartins

Antwort

4

Um die Basis-URL für die Dateien zu ändern, die von iPython bereitgestellt werden, bearbeiten Sie die Datei ipython_notebook_config.py in Ihrem Verzeichnis ~/.ipython/[profile-name]/.

Insbesondere unter der Annahme, dass Ihre Konfigurationsdatei mit der Zeile beginnt c = get_config(), Sie wollen die folgenden Zeilen zu Ihrer Konfiguration hinzuzufügen:

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

Dadurch wird es so, dass Ihr Projekt bis von http://localhost:8888/ipython/ serviert anstelle von http://localhost:8888/.

Weitere Informationen finden Sie unter this page of the ipython docs.