djangojupyter-notebookdjango-extensions

What is the way to set ipython notebook server parameters when running notebook with django-extensions?


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.

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.

How can I set the notebook server settings when launching the notebook server with django using

    ./manage.py shell_plus --notebook

?

Thank you in advance.


Solution

  • 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
    

    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
    

    You can see more on this config file here: http://ipython.org/ipython-doc/1/interactive/public_server.html