PyCharm 2024.1 Help

Part 6. Django-specific navigation

Enable the Django plugin

This functionality relies on the Django plugin, which is bundled and enabled in PyCharm by default. If the relevant features aren't available, make sure that you didn't disable the plugin.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Plugins.

  2. Open the Installed tab, find the Django plugin, and select the checkbox next to the plugin name.

Finally, you will explore the Django-specific navigation.

Note that same type of navigation is available for the other frameworks, such as Pyramid and Flask.

Use the example from the "first steps" guide Create and run your first Django project.

Jumping from a view to a template

Open the file for editing F4. In the gutter, next to the line template_name = "polls/index.html", you see the icon .

Hovering over this icon reveals the following popup:

Go to template

Clicking this icon results in jumping directly to the template index.html, that resides in the folder polls under templates.

Jumping from a template to a view

In the gutter of the template file index.html, you see the icon .

Go to Python file

Clicking this icon leads you directly to the corresponding view.

Jumping between views and file

PyCharm allows you to easily navigate between a particular view and the corresponding url. This is how it's done:

  1. Hover over the view name, while keeping Ctrl key pressed, and see the view name turning into a hyperlink:

    Jump to detail via URL
  2. If you click this hyperlink, you'll jump directly to the corresponding URL:

    Jump to a template

Vice versa, you can also jump from a URL to the corresponding view. Again, in the file, hover over the view name, while keeping Ctrl key pressed, and see the view name turning into a hyperlink.

Ctrl+Click the view name - and find yourself in the corresponding view.

In a Django project, you see the same icons and as in a pure Python project. When you hover over such an icon, you see a popup, like the following:

Navigation with a gutter icon

You can also jump to a declaration or implementation of a symbol. To do that, just place the caret at the implementing/overriding symbol and press Ctrl+B or Ctrl+Alt+B (or choose Navigate | Declaration or Usages or Navigate | Implementation from the main menu):

Navigate to declaration or implementation

Jumping to tests

Django applications can be tested same as the pure Python ones. Same way you can create tests for the Django projects, for example, press Ctrl+Shift+T:

Create a Django test

Fill in the form in the Create test dialog:

Create a test dialog

You'll see the code like:

from unittest import TestCase class TestToDoItem(TestCase): pass

It's up to you to write some meaningful code.


This brief tutorial is over. You've mastered the following features:

  • Used the gutter icons to navigate between views and templates.

  • Navigated between views and urls.

  • Repeated how to jump to an implementation or declaration.

  • Repeated how to navigate to an existing test or create a new one.

Last modified: 29 March 2024