🗂️Project WITHOUT React/Vite (Python backend + plain HTML/CSS/JS frontend)
Backend:
source .venv/bin/activate
python app.py
Frontend (no build tool needed — just serve the static files):
python3 -m http.server 5500
or right-click index.html → "Open with Live Server" if you're in VS Code.
⚛️ Project WITH React/Vite (Python backend)
Backend:
source .venv/bin/activate
python app.py
Frontend:
npm run dev
🗑️ *Deleting a virtual environment
*
deactivate
rm -rf .venv
✨** Creating a fresh one
**
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
🆕 First time in a project only do:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
🔁 Every time after:
source .venv/bin/activate
python app.py
🔍 Check if venv exists:
ls -a → spot .venv in the list
✅ Check if venv is actually active:
which python → should point inside .venv
⚠️ don't fully trust the (.venv) label in your prompt — it can lie!
♻️ Only redo the first-time steps if:
🗑️ you delete .venv
💻 you're on a new machine
📦 requirements.txt got new packages
Top comments (1)
This is a good one to bookmark. The "don't fully trust the (.venv) label" line is the part I'd underline. I got burned by that exact thing early on, had the prompt showing (.venv) and was still installing packages globally because I'd activated a venv in one terminal tab and was running commands in another.
The which python check is the one that actually settles it. If it's not pointing inside .venv, nothing else matters.
One thing I'd add to the list: pip list once you've confirmed you're in the right venv, just to see what's actually installed vs what requirements.txt says should be there. Caught a few "why isn't this working" moments that turned out to be a requirements.txt that never got rerun after a new package got added.