Skip to content

Instantly share code, notes, and snippets.

@cecepm
Last active January 2, 2016 19:09
Show Gist options
  • Select an option

  • Save cecepm/8348725 to your computer and use it in GitHub Desktop.

Select an option

Save cecepm/8348725 to your computer and use it in GitHub Desktop.
Run Django Shell using IPython Notebook

Tested with iPython 2.0, Django 1.6

Install

Install Django Extension

pip install django-extensions

Install IPython

sudo apt-get install libzmq-dev
pip install pyzmq
pip install pygments
pip install jinja2 
pip install tornado
pip install ipython

Configuration

Edit settings.py, add django-extensions to INSTALLED_APPS

INSTALLED_APPS += (
    'django_extensions',
)

Run Django Shell with IPython Notebook

./manage.py shell_plus --notebook

Access IPython Notebook from network

Example, vagrant user want access ipython notebook running in vagrant vm, from their host. Edit default profile used by ipython notebook, then add ipython_notebook_config.py.

If you run django as user vagrant, probably your full path to ipython notebook configuration is /home/vagrant/.ipython/profile_default/ipython_notebook_config.py

c = get_config()
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9999
c.FileNotebookManager.notebook_dir = u'/vagrant/notebooks'
c.InteractiveShellApp.exec_lines = [
'from django.conf import settings'
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment