Skip to content

Installation Django

To install Django, you must have Python installed, and a package manager like PIP. In other words, using ~=4.0 ensures that you get the latest minor release of Django within the 4.0 series. For example, it could install Django 4.0.1, 4.0.2, 4.1.0, etc., but it won't install Django 5.0 or higher.

install

pip install django~=4.0

verify

django-admin --version

Using Poetry (Python dependency management tool)

If you prefer using Poetry for managing dependencies:

  1. Install Poetry: Install Poetry by following the instructions at python-poetry.org.

  2. Create a new Django project and install Django 4:

    poetry new myproject
    cd myproject
    poetry add django~=4.0
    
  3. Activate virtual environment: Poetry automatically creates a virtual environment for each project. To activate it, run:

    poetry shell
    
  4. Verify installation: Check Django version:

    python -m django --version