IntelliJ IDEA 2022.1 Help

Django support

Prerequisite

Django framework and the corresponding Python interpreter are properly installed on your machine.

Supported versions of Django and Python

IntelliJ IDEA supports the latest Django versions. The corresponding Python versions depend on Django. See What Python version can I use with Django?

Django support

Django support in IntelliJ IDEA includes:

  • Dedicated project and module type.

  • Ability to run the tasks of the manage.py utility.

  • Django templates support (syntax and error highlighting, code completion, navigation, completion for block names, resolve and completion for custom tags and filters, and quick documentation for tags and filters).

  • Ability to create templates from usage.

  • Ability to debug Django templates.

  • Live templates (snippets) for the quick development of Django templates.

  • Run/debug configuration for Django server.

  • Navigation between views and templates.

  • Code insight support for Django ORM.

  • Code completion and resolve in

    • views.py and urls.py files:

      Code completion for the view.py
    • Models:

      Code completion for the model
    • Meta model options:

      Meta model options
    • Configuration constants in the settings.py file

      Completion for configuration constants in
                            settings.py file
  • Class-based views. IntelliJ IDEA provides Intention action to convert Django function-based generic views to class-based views.

  • Generating model dependency diagrams for Django models.

Enabling or disabling Django support

Django support can be turned on or off by attaching or detaching the Django facet.

  1. From the main menu, select File | Project Structure Ctrl+Alt+Shift+S.

  2. In the Modules node, select the desired module to which Django support should be added, and click the Add button.

  3. Choose Django from the popup menu:

    Adding Django support to a module in the Project Structure dialog
  4. Select the Django node under the module node and specify the required parameters in the right-hand pane.

Last modified: 10 August 2022