.gitignore for Django

Django local settings, SQLite database, media files, and static collection.

Quick presets

Selected (1)
Django
Your selections never leave your browser. Generation happens entirely client-side.
Raw

13 patterns · 263 B

# Generated by DevZone Tools — https://devzone.tools/tools/gitignore-generator
# Templates: Django
# 2026-04-20

# ---- Django ----
# Django
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
db.sqlite3-journal
media
staticfiles/
.env
.venv
venv/
ENV/

What this template ignores

Ignores local_settings.py (machine-specific config), the SQLite development database, uploaded media files, collected static files, and virtual environments.

Common additions

  • +celerybeat-schedule — Celery periodic task schedule
  • +*.sqlite3 — all SQLite databases

Commonly paired with

Frequently asked questions

Do I need to commit .gitignore?
Yes — .gitignore should be committed to the repository so all collaborators benefit from the same ignore rules.
How do I add custom patterns?
Open your .gitignore file and add the pattern on a new line. Use # for comments, * for wildcards, / to match directories, and ! to un-ignore a previously ignored path.
How do I ignore a file that is already tracked?
Adding a file to .gitignore does not remove it from tracking if it was previously committed. Run: git rm --cached <file> to stop tracking it without deleting the file locally.
Should I commit the SQLite database?
No — the SQLite database contains local development data and may grow large. Use migrations to define schema; never commit db.sqlite3.
Should I commit local_settings.py?
No — local_settings.py contains machine-specific settings and often secrets like DEBUG=True or local database credentials.

Looking for something else? Browse all templates →