Django 6 cheatsheet

Django 6: Setup

7 common Django 6 tasks.

Create a virtual environment

Create an isolated environment for the project's packages.

python3 -m venv .venv

Install Django

Install Django into the active virtual environment.

python -m pip install django

Check the Django version

Print the installed Django version.

python -m django --version

Create a project

Create a project in the current folder, so manage.py sits next to your repository root.

django-admin startproject config .

Create an app

Create a new app inside the project. Add it to INSTALLED_APPS afterwards.

python manage.py startapp blog

Start the development server

Run the app at http://127.0.0.1:8000 with auto-reload.

python manage.py runserver

Change the address and port

Listen on all interfaces on port 8080.

python manage.py runserver 0.0.0.0:8080

Caution: Binding to 0.0.0.0 exposes the development server to your network.

Was this page helpful?