Bytecode
- Input
- __pycache__/views.cpython-312.pyc
- Expected output
- ignorado / ignored
The __pycache__/ folder is excluded.
gitignore python django
Pick Python, Virtualenv and your editor in the Generate tab. Django has no template of its own: the Python one already carries the Django rules, such as db.sqlite3 and local_settings.py.
The __pycache__/ folder is excluded.
No rule matches.
The db.sqlite3 rule from the Django section.
The .venv folder is excluded.
The *.mo rule catches the file.
The unanchored lib/ matches the folder at any level.
Tap the shortcut for your stack (Next.js, Python, Laravel, Unity and others) or search by name: react and vite open the Node template, django opens Python. Add the editor (Visual Studio Code, JetBrains) and the operating system (macOS, Windows, Linux) of the people working on the project, copy the result and save it as .gitignore at the repository root. Editor and OS templates can also go to a global file (core.excludesFile) so they do not clutter the project.
No. The Django rules live inside the Python template (*.log, local_settings.py, db.sqlite3, db.sqlite3-journal). That is why the tool's Django shortcut uses Python and Virtualenv.
You should not: the environment depends on the machine and system, and is rebuilt from requirements.txt or pyproject.toml. The template ignores .venv, venv/ and env/.
Add a specific negation after the *.mo rule, such as !locale/pt_BR/LC_MESSAGES/django.mo. Since *.mo ignores files and not folders, the negation takes effect.
Loading templates...
Pick at least one template to generate the file.
Loading templates...
# Normalize line endings: Git detects text files, LF in the repository. * text=auto eol=lf # Shell scripts need LF; Windows scripts need CRLF. *.sh text eol=lf *.bat text eol=crlf *.cmd text eol=crlf *.ps1 text eol=crlf # Binary files: no conversion and no text diff. *.png binary *.jpg binary *.jpeg binary *.gif binary *.ico binary *.webp binary *.pdf binary *.zip binary *.gz binary *.woff binary *.woff2 binary # Lock files: GitHub collapses them in diffs. package-lock.json linguist-generated yarn.lock linguist-generated pnpm-lock.yaml linguist-generated
.gitignore only applies to files Git does not track yet. To stop tracking without deleting from disk:
git rm --cached path/to/file git rm -r --cached path/to/folder git commit -m "Stop tracking ignored files"
To re-apply the .gitignore to everything at once (review git status before committing):
git rm -r --cached . git add . git commit -m "Apply .gitignore"
To ignore only on your machine, use a global file (core.excludesFile) or the clone's .git/info/exclude, with the same syntax:
git config --global core.excludesFile ~/.gitignore_global .git/info/exclude
No problems found in the rules.