Installing Python and Django - potatoscript/django GitHub Wiki

🧰 What You Need Before Starting

πŸ“¦ Tool βœ… Required
🐍 Python 3 Yes!
πŸ’» A Terminal (Command Prompt / Terminal app) Yes!
🧠 Curiosity & patience Absolutely yes!

🌐 Step 1: Install Python (for Windows, macOS, Linux)

πŸ”Ή For Windows

  1. πŸ‘‰ Go to https://www.python.org/downloads/

  2. Click the big yellow button that says Download Python 3.x.x

  3. VERY IMPORTANT: βœ… Check the box β€œAdd Python to PATH” before clicking Install Now
    Add Python to PATH

  4. Wait until it finishes. Then open Command Prompt (CMD) and type:

python --version

βœ… You should see something like:

Python 3.12.1

πŸŽ‰ You did it!


🍎 For macOS

  1. macOS often comes with Python installed, but it’s usually Python 2.
  2. So, open Terminal and install Homebrew (if you don’t have it):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Then install Python:
brew install python
  1. Check the version:
python3 --version

πŸŽ‰ Done!


🐧 For Linux (Ubuntu/Debian)

Open your Terminal and run:

sudo apt update
sudo apt install python3 python3-pip

Check:

python3 --version

πŸŽ‰ Ready to roll!


πŸ§ͺ Step 2: Create a Virtual Environment

A virtual environment is like a sandbox just for your project.
It keeps your project clean and tidy 🧼

  1. In your Terminal, make a new folder:
mkdir django_app
cd django_app
  1. Create the virtual environment:
python -m venv env
  1. Activate the virtual environment:
  • πŸͺŸ Windows:
env\Scripts\activate
  • 🍏 Mac/Linux:
source env/bin/activate

✨ If it works, your terminal prompt will show:

(env) your-folder-name $

πŸ’‘ Don’t forget to activate your environment every time before coding Django.


πŸ“¦ Step 3: Install Django

While inside your virtual environment, run:

pip install django

βœ… To confirm Django installed:

django-admin --version

Output:

5.0.3

πŸŽ‰ You just installed Django!


🎁 Bonus: Freeze Your Requirements (Optional but Professional)

Let’s record the installed packages so others can copy your setup:

pip freeze > requirements.txt

Later, you (or your team) can run:

pip install -r requirements.txt

πŸ”₯ Very pro move!