TExcelTAD
Home › Django › Django Get Started

Django Get Started

To build a Django site on your own computer you need Python (Django 5.2 supports Python 3.10 – 3.14), a virtual environment to keep the project's packages separate, and the Django package itself. This lesson walks through the setup once; afterwards, every example in this course runs directly in your browser.

Step 1: Check Python

bash · try it yourself
python3 --version
Python 3.13.1

On Windows, the command is usually py --version. If Python is missing, install it from python.org.

Step 2: Create a virtual environment

A virtual environment is a private folder of packages for one project. Create it inside a new project folder and activate it:

bash · try it yourself
mkdir bookshelf && cd bookshelf
python3 -m venv .venv
source .venv/bin/activate
(.venv) $

The (.venv) prefix in your prompt shows the environment is active. On Windows, activate it with .venv\Scripts\activate.

Step 3: Install Django

bash · try it yourself
python -m pip install "Django==5.2.*"
python -m django --version
Successfully installed Django-5.2.18 asgiref-3.9.1 sqlparse-0.5.3
5.2.18

Tip: Save your dependencies with pip freeze > requirements.txt so others (and your server) can install exactly the same versions with pip install -r requirements.txt.

Step 4: Create a project

django-admin startproject generates the skeleton of a project. The trailing dot puts it in the current folder instead of creating another nested one:

bash · try it yourself
django-admin startproject mysite .
ls
manage.py  mysite

The generated layout:

text
bookshelf/
├── manage.py          # command-line helper: runserver, migrate, createsuperuser …
└── mysite/            # the project's Python package
    ├── __init__.py
    ├── settings.py    # all configuration: apps, database, templates …
    ├── urls.py        # the root URLconf (URL → view table)
    ├── asgi.py        # entry point for ASGI servers (async)
    └── wsgi.py        # entry point for WSGI servers such as gunicorn
File Purpose
manage.py Runs Django commands for this project (python manage.py <command>)
settings.py INSTALLED_APPS, DATABASES, TEMPLATES, DEBUG, SECRET_KEY …
urls.py The list urlpatterns that routes URLs to views
wsgi.py / asgi.py How production servers load your project

Step 5: Run the development server

bash · try it yourself
python manage.py migrate
python manage.py runserver
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  ...
  Applying sessions.0001_initial... OK
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
October 16, 2026 - 09:30:00
Django version 5.2.18, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

migrate creates the database tables Django's built-in apps need (in a file called db.sqlite3). runserver starts a lightweight web server that reloads automatically when you save a file. Open http://127.0.0.1:8000/ and you'll see Django's rocket "The install worked successfully!" page.

Note: runserver is for development only. In production you use a real server such as gunicorn or uvicorn — see Settings & Deployment.

Useful manage.py commands

Command What it does
runserver [port] Start the development server
startapp <name> Create a new app folder
makemigrations Turn model changes into migration files
migrate Apply migrations to the database
createsuperuser Create an admin user
shell Python shell with your project loaded
test Run the test suite
check Look for configuration problems

Checking your installation from Python

Everything Django can tell you about itself is also available from Python. This snippet runs in the browser playground with real Django:

python · try it yourself
import django
from django.conf import settings
settings.configure()
django.setup()

print("Django", django.get_version())
print("VERSION tuple:", django.VERSION)
print("Default DEBUG:", settings.DEBUG)
print("Default time zone:", settings.TIME_ZONE)
Django 5.2.18
VERSION tuple: (5, 2, 18, 'final', 0)
Default DEBUG: False
Default time zone: America/Chicago

settings.configure() without arguments uses Django's global defaults. A project generated by startproject overrides many of them — for example it sets TIME_ZONE = "UTC" and DEBUG = True.

Test yourself

Which command creates a new Django project skeleton?

  1. python manage.py startapp mysite
  2. django-admin startproject mysite
  3. pip install mysite
  4. python -m venv mysite

Which file holds the list of installed apps and the database configuration?

  1. urls.py
  2. manage.py
  3. settings.py
  4. wsgi.py

Why use a virtual environment for a Django project?

  1. It makes Django run faster
  2. It keeps the project's packages isolated from other projects
  3. It is required by runserver
  4. It creates the database