Changing notebook directory leads to an error in loading extensions

Viewed 154

I'm running an IPython notebook through Django's shell_plus with the following command:

sudo ./manage.py shell_plus --notebook

I'm not entirel sure how it works, but ./manage.py shell_plus knows to look for additional settings in django's settings.py file, where I have the following IPython arguments:

IPYTHON_ARGUMENTS = [
    '--ext', 'django_extensions.management.notebook_extension',
    '--profile=mitchell',
    '--port=8889',
    '--notebook-dir=/home/rootadmin/server/',
    '--certfile=/ssl/fullchain.pem',
    '--keyfile=/ssl/privkey.pem',
    '--ip=*',
    '--no-browser',
    '--no-mathjax',
]

So far this all works as intended. It runs a notebook server, that I can access and it serves any notebook file within the notebook-dir, which is the same directory from which I run the ./manage.py shell_plus --notebook command. I can execute code, and have access to my django models.

However, this is my general home directory and I don't want all my notebooks in this directory. I made a new directory, from which I want to serve my notebooks. I change my notebook-dir accordingly.

    '--notebook-dir=/home/rootadmin/server/jupyter_directory',

Then, if I run the notebook, it initially appears to work: I can access it online, and it shows me the notebooks within the jupyter_directory, however, when I try to run any code that required my django models, it no longer works, saying that these models are undefined. In the terminal, where I started the notebook I see the following error:

[IPKernelApp] WARNING | Error in loading extension: django_extensions.management.notebook_extension
Check your config files in /home/rootadmin/.ipython/profile_mitchell

I don't know what to check for. I'm assuming the error is because it's trying to import from a wrong location now. How can I serve directory A, and import from directory B?

0 Answers
Related