使用Django扩展名运行笔记本时,如何设置ipython笔记本服务器参数? [英] What is the way to set ipython notebook server parameters when running notebook with django-extensions?
问题描述
我正在使用以下命令通过django运行ipython笔记本服务器:
I am using the following command to run an ipython notebook server with django:
./manage.py shell_plus --notebook
服务器正常运行.但是,我想设置端口,并且在启动服务器时不启动浏览器.
The server functions as expected. However, I would like to set the port and not launch a browser when starting the server.
如果我运行的是不带Django的IPython笔记本服务器,那么我将成功使用以下代码:
If I were running an IPython notebook server without django I successfully use the following:
ipython notebook --port=9999 --no-browser
我在此处中查看了文档,并尝试使用
I checked the documentation here and tried setting the options using
IPYTHON_ARGUMENTS = [
'--ext', 'django_extensions.management.notebook_extension',
'--port=9999',
'--no-browser,
]
这些参数是在服务器启动后加载的,并且不会改变我收集到的笔记本服务器设置.
These arguments are loaded after the server has already started and do not change the notebook server settings from what I can gather.
使用django启动笔记本服务器时,如何设置笔记本服务器设置
How can I set the notebook server settings when launching the notebook server with django using
./manage.py shell_plus --notebook
?
谢谢.
推荐答案
我遇到了同样的问题,我通过在与manage.py
相同的文件夹中创建一个名为ipython_config.py
的新文件来解决此问题,该文件具有以下内容:
I had the same problem, and I solved it by creating a new file called ipython_config.py
in the same folder as manage.py
with the following content:
c = get_config()
# Notebook server config below
# Kernel config
c.IPKernelApp.pylab = 'inline' # if you want plotting support always
# Notebook config: ip address and port
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8888
# disables the browser
c.NotebookApp.open_browser = False
此后,我只需运行即可在所需的端口和IP地址上运行ipython笔记本服务器,而无需启动浏览器
After this I was able to run the ipython notebook server on the required port and IP address, without launching a browser, simply by running
python manage.py shell_plus --notebook
您可以在此处查看有关此配置文件的更多信息: http://ipython. org/ipython-doc/1/interactive/public_server.html
You can see more on this config file here: http://ipython.org/ipython-doc/1/interactive/public_server.html
这篇关于使用Django扩展名运行笔记本时,如何设置ipython笔记本服务器参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!