Flask .gitignore by Scenario
Choose your Flask .gitignore based on your project type. From lightweight microservices to full web applications, get the perfect ignore patterns for your specific use case.
Microservices
API-first, minimal footprint
Web Applications
Full-stack with templates & assets
Cloud Native
Docker, K8s, serverless
Select Your Flask Project Type
Microservice API
Lightweight Flask API with minimal dependencies
Full Web Application
Complete Flask web app with templates and static files
Dockerized Flask
Flask application with Docker containerization
Microservice API
Perfect for: REST APIs, authentication services, data processors
# Flask Microservice .gitignore
# Flask instance folder
instance/
# Environment variables
.env
.env.local
.flaskenv
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Virtual environments
venv/
ENV/
env/
.venv/
# Database
*.db
*.sqlite
*.sqlite3
# Logs
*.log
logs/
app.log
# Testing
.pytest_cache/
.coverage
.coverage.*
htmlcov/
.tox/
.nox/
# IDE
.vscode/
.idea/
*.swp
*.swo
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Deployment
*.pyc
.cache/
Deployment-Specific Patterns
Heroku Deployment
Procfile, runtime.txt, requirements.txt
# Heroku specific
.env
.env.local
staticfiles/
.herokuapp/
AWS Lambda
zappa_settings.json, lambda packages
# AWS Lambda
.aws/
zappa_settings.json
lambda_packages/
*.zip
Docker Compose
docker-compose.yml, volumes
# Docker Compose
docker-compose.override.yml
volumes/
.docker/
Traditional Server
Nginx configs, systemd services
# Traditional deployment
*.conf
*.service
deployment_scripts/
Flask Configuration Guidelines
Essential Patterns
instance/
.env .flaskenv
/uploads/ /media/
Advanced Considerations
Large Flask apps with blueprints may need specific static file handling
Consider team policy for Flask-Migrate version files
Include test databases and coverage reports in ignores
Ready to Build Your Flask Project?
Start with the right .gitignore configuration and avoid common pitfalls from day one.