Create an isolated virtual environment, install Django, generate your first project, and run the development server — the foundation every later lesson builds on.
Why: a virtual environment is a private copy of Python whose installed packages stay separate from every other project — so two projects can use different Django versions without clashing. Note: you reactivate it every time you open a new terminal; your prompt shows (.venv) when it is active.
Make a project folder and create the environment inside it:
mkdir myblogcd myblogpython -m venv .venvActivate it — Windows (PowerShell):
.venv\Scripts\Activate.ps1Activate it — macOS / Linux:
source .venv/bin/activateWhy: Django is a normal Python package, so pip installs it into the active environment. Note: pip freeze writes the exact versions to requirements.txt so anyone (including a server) can recreate the same setup with pip install -r requirements.txt.
With (.venv) active:
pip install djangopython -m django --versionpip freeze > requirements.txtWhy: startproject scaffolds the configuration package and the manage.py command runner. Note: the trailing dot tells Django to put the files in the current folder instead of creating an extra nested one. "config" is just the package name — you could call it "myblog" too, but "config" reads clearly as "this is project configuration".
django-admin startproject config .Where: manage.py is the command runner you call for everything (runserver, migrate, createsuperuser). config/settings.py holds all configuration. config/urls.py is the master URL map. asgi.py and wsgi.py are the entry points a production server uses.
myblog/
├── .venv/ # your virtual environment
├── manage.py # run commands: python manage.py <command>
├── requirements.txt
└── config/
├── __init__.py
├── settings.py # all project configuration
├── urls.py # master URL map
├── asgi.py # async server entry point
└── wsgi.py # sync server entry pointWhy: runserver starts a lightweight web server that auto-reloads whenever you save a file — never use it in production. Note: the "unapplied migrations" warning is expected on a fresh project; you fix it in the Models lesson. Open the URL to see the Django welcome rocket.
Then visit http://127.0.0.1:8000 — press Ctrl+C to stop:
python manage.py runserver