Skip to content

Commit

Permalink
make jupyter notebook work again
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Nov 17, 2023
1 parent f55f180 commit 22e1972
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
django: PYTHONUNBUFFERED=true python manage.py runserver --settings example.settings 0.0:8000
jupyterlab: DJANGO_ALLOW_ASYNC_UNSAFE=true python manage.py shell_plus --notebook
jupyterlab: DJANGO_ALLOW_ASYNC_UNSAFE=true python manage.py shell_plus --settings example.settings --notebook
21 changes: 21 additions & 0 deletions example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@
# See: https://docs.djangoproject.com/en/dev/ref/settings/#media-url
MEDIA_URL = "/media/"

# Jupyter notebook stuff
PATH_TO_NOTEBOOK_DIR = "notebooks"
try:
import jupyterlab # noqa

notebook_default_url = "/lab" # Using JupyterLab
except ImportError:
notebook_default_url = "/tree" # Using Jupyter

NOTEBOOK_ARGUMENTS = [
"--ip",
"127.0.0.1",
"--port",
"8888",
"--notebook-dir",
PATH_TO_NOTEBOOK_DIR,
"--NotebookApp.default_url",
notebook_default_url,
]
IPYTHON_KERNEL_DISPLAY_NAME = "Django Kernel"


# TEMPLATE CONFIGURATION
# ------------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ dev = [
"django_extensions",
"isort",
"jupyter",
"jupyter-server",
"jupyterlab",
"jupyter-server < 2.0.0",
"notebook",
"pyzmq >= 25.1.1",
"setuptools",
"tox",
"traitlets < 5.10.0", # https://github.com/microsoft/azuredatastudio/issues/24436 - jupyterlab wont work
"typer",
]

Expand Down

0 comments on commit 22e1972

Please sign in to comment.