← Developer Tools
🚫

Python .gitignore — __pycache__, venv, Django & FastAPI

Generate .gitignore files for any stack — instantly, offline, free

💡

Generate a complete .gitignore for Python projects. Covers __pycache__, virtual environments, .pyc files, .pytest_cache, .mypy_cache, dist, eggs, and .env. Add Django or FastAPI patterns.

⚡ Quick Start:
STACKS8 selected
🔍
Selected stacks:
🪟 Windows 🍎 macOS 💙 VS Code 💚 Node.js ⚛️ React 🔐 .env Files 📋 Log Files 🔑 Secrets
GROUP BY CATEGORY
FORMAT
OUTPUT · .gitignore
# ============================================================
# Generated: CalcNation .gitignore Generator · 2026-03-14
# Stacks   : Windows, macOS, VS Code, Node.js, React, .env Files, Log Files, Secrets
# Format   : .gitignore
# ============================================================

# ────────────────────────────────────────────────────────────
# OS
# ────────────────────────────────────────────────────────────

# 🪟 Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
*.lnk

# 🍎 macOS
.DS_Store
.AppleDouble
.LSOverride
Icon
.Spotlight-V100
.Trashes
._*
.fseventsd

# ────────────────────────────────────────────────────────────
# IDE
# ────────────────────────────────────────────────────────────

# 💙 VS Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
.history/

# ────────────────────────────────────────────────────────────
# LANGUAGE
# ────────────────────────────────────────────────────────────

# 💚 Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnp.cjs
.pnp.loader.mjs
.yarn/cache
dist/
build/
coverage/

# ────────────────────────────────────────────────────────────
# FRAMEWORK
# ────────────────────────────────────────────────────────────

# ⚛️ React
# React build output
build/
.env.local
.env.development.local
.env.test.local
.env.production.local

# ────────────────────────────────────────────────────────────
# TOOLS
# ────────────────────────────────────────────────────────────

# 🔐 .env Files
.env
.env.local
.env.*.local
.env.development
.env.test
.env.production
!.env.example
!.env.sample

# 📋 Log Files
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# 🔑 Secrets
# Security — never commit these
*.pem
*.key
*.p12
*.pfx
*.cer
*.crt
id_rsa
id_rsa.pub
*.secret
secrets.json
secrets.yaml
*.keystore

📄 110 lines·💾 3.1 KB·📦 8 stacks·🔧 .gitignore

Frequently Asked Questions

Should I commit requirements.txt?

Yes — requirements.txt or pyproject.toml should be committed. These define your dependencies. Only ignore the venv directory itself, not the requirements file.

What virtual environment directories are covered?

The Python stack ignores env/, venv/, .venv/, ENV/ — the most common virtual environment directory names used across different tools (pip, poetry, pyenv).

What about .env in Python projects?

The .env Files stack adds comprehensive .env coverage. Django also ignores .env specifically. Always keep .env.example committed as documentation.

Does it cover Poetry and PDM?

Yes — *.egg-info/, dist/, and build/ are covered for all Python packaging tools. Poetry's .venv is covered by the .venv/ pattern.

What about Jupyter notebooks?

Jupyter .ipynb_checkpoints/ are included in the Python patterns. The .env and Coverage stacks add further relevant exclusions for ML projects.