![]() ![]() This assumes you have a Jupyter virtual environment that's separate from Django's one and whose kernels/extensions are installed with -user. django_extensions right now still does only part of the required work :-) Just for completeness (but it's 2018, so maybe things changed since this question was posted): you can actually install a Jupyter Python kernel in your Django environment that will then connect (run under) a different Jupyter server/environment (one where you've installed widgets, extensions, changed the theme, etc.). Os.tdefault("DJANGO_SETTINGS_MODULE", "settingsfile") The code I run in the notebook is: import os, sys ![]() What should I do to get Django and Jupyter to play nicely?įor - I am using Django 1.8.5 with Jupyter 1.0.0. However, I was not able to figure out how to get Jupyter to run the extension automatically so I would not have to do this again for each and every notebook I am creating. I am able to run Django code in the Jupyter notebook by adding a similar bit of code to the first cell of the notebook. With a recent upgrade to Jupyter Notebook this setup is now broken for me. Os.tdefault("DJANGO_SETTINGS_MODULE", "settings") # instance, which can be used in any way. # The `ipython` argument is the currently active `InteractiveShell` The code for the extension is: def load_ipython_extension(ipython): The gist of the method is to create an IPython extension which sets the DJANGO_SETTINGS_MODULE and runs tup() when IPython starts. I have been using the method described in this post for setting up IPython Notebook to play nicely with Django. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |