Having shell with full access to the project files and database is crucial to its development and testing.
In this tutorial, we will use Cookiecutter Django.
First, we need to install and run it:
Cookiecutter will ask us for configuration options. We can keep pressing enter (selecting default option) until the
use_docker [n]: which we accept by
First, we add Jupyter to the project requirements in
We can do it by appending
jupyter==1.0.0 at the end of the file.
We modify settings to allow jupyter running in a container. At the end of the file
config/settings/local.py we add:
Next, we build and run the project:
As we can see on
http://127.0.0.1:8000/, the project runs perfectly.
Now we can run the Jupyter Notebook:
And open the link displayed in the console to access the notebook (something like http://0.0.0.0:8888/?token=secrettoken).
Now our notebook has access to the project database and files.
After modifying project files, there is no need to restart the whole shell, like we have to do in using
shell_plus without the online notebook. We just need to restart kernel in the web interface.
If you have any question or problem with it, let me know in the comments.