pip install django and Pinning Versions
Install Django and record it in requirements.txt.
pip install django and Pinning Versions is a free Django Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Django Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Install Django with pip
With your environment active, installing Django is one command. pip downloads it and every dependency it needs to run. 📦
pip install djangoConfirm the Version
After installing, check which version you got. Knowing the exact version helps you match docs and avoid surprises later.
python -m django --versionWhy Versions Matter
Django evolves, and APIs change between releases. Pinning a version means your code runs the same way everywhere, today and next year.
Install an Exact Version
You can ask pip for a specific release using double equals. This locks Django to exactly the version you tested with.
pip install django==5.0.6Meet requirements.txt
A requirements.txt file lists every package your project needs. Anyone can recreate your exact setup from this one file.
Freeze Your Packages
Let pip write the file for you. pip freeze lists installed packages with their exact versions, ready to save.
pip freeze > requirements.txtRead the Pinned File
Inside, each line pins a package to a version. This pin guarantees the same install on every machine and server.
django==5.0.6
asgiref==3.8.1Install from the File
On a new machine, recreate everything at once. The -r flag tells pip to install each package listed in the file.
pip install -r requirements.txtCompatible Release Pins
The ~= operator allows safe patch updates while blocking breaking ones, so you get fixes without nasty surprises.
django~=5.0.0Commit the Requirements File
Unlike the venv folder, you do commit requirements.txt to Git. It is small and lets teammates rebuild the exact environment.
Upgrade Deliberately
Bump versions on purpose, then test. Edit the pin, reinstall, and run your app so upgrades never sneak in unnoticed.
pip install -U djangoQuick Check
Let's review pinning versions.
Recap
You installed Django, pinned an exact version, and froze it into requirements.txt for reproducible setups everywhere. Solid habits! 🎉
Frequently asked questions
Is the “pip install django and Pinning Versions” lesson free?
Yes — the full text of “pip install django and Pinning Versions” is free to read here on the web, and the Django Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Django Academy course, upgrade to CoddyKit PRO.
What will I learn in “pip install django and Pinning Versions”?
Install Django and record it in requirements.txt. You practise Django Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Django Academy?
No prior experience is required. Django Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “pip install django and Pinning Versions” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Django Academy lesson?
Yes. Every Django Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Virtual Environments with venv
- pip install django and Pinning Versions
- django-admin startproject Explained
- Run the Dev Server with runserver