Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to install dj-notebook in PyCharm Professional. #117

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added docs/img/pycharm/add_package.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/pycharm/create_notebook.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/pycharm/install_dj-notebook.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/pycharm/interpreter_menu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/pycharm/notebook_working.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/pycharm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Using dj-notebook with PyCharm

PyCharm Professional has built-in integration for Jupyter notebooks. This integration works well with dj-notebook once your jupyter and dj-notebook are added to your existing Django project's virtual environment.

## Quick Start

1. Open your existing django project in pycharm.
2. Make sure that pycharm's interpreter is configured for your project's virtual environment.
3. Add dj-notebook and jupyter to that virtual environment.
4. Create a new notebook and load your django settings in the first cell.
5. Execute that cell to launch the Jupyter server.

## Adding dj-notebook to your Virtual Environment

![PyCharm Interpreter Menu](img/pycharm/interpreter_menu.png)

Once pycharm has loaded your django project, you can inspect the virtual environment used by the project's interpreter by using the interpreter menu in the lower right corner of the project window. Click on the current interpreter (1) then choose "Interpreter Settings..." to to confirm the location of the virtual environment and see which packages are loaded there.

If jupyter and dj-notebook are not already installed, you can add them from the IDE by clicking the add button then searching for dj-notebook:

![PyCharm - Add package](img/pycharm/add_package.png)

Then click "Install Package":

![PyCharm - Install dj-notebook](img/pycharm/install_dj-notebook.png)

## Using dj-notebook Within PyCharm's Integrated Notebook View

Once dj-notebook is installed, you can create a new notebook from within the project explorer:

![PyCharm - Create new notebook](img/pycharm/create_notebook.png)

In the new notebook, when you execute your first cell, PyCharm will start the Jupyter server and display the results inline. Once the server is started, dj-notebook [just works, as described in the usage guide](https://dj-notebook.readthedocs.io/en/latest/usage/). PyCharm's notebook interface [is documented here](https://www.jetbrains.com/help/pycharm/jupyter-notebook-support.html#ui).

![PyCharm - working notebook](img/pycharm/notebook_working.png)