且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Django扩展名运行笔记本时,如何设置ipython笔记本服务器参数?

更新时间:2023-09-12 10:26:04

我遇到了同样的问题,我通过在与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