A .gitignore
is a file that specifies files and directories that git should ignore when adding files to the repository.
The .gitignore
is usually placed in the root directory of the repository, and it applies to all subdirectories underneath it.
Some patterns in a .gitignore
file are:
*.pyc
- which matches any file with the.pyc
extension.env/
- which matches.env
directory
I have outlined the most basic files that a Django developer can have in a .gitignore
file.
# Django-specific files
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
# Virtual Environment
.env
venv/
env/
# PyCharm-specific files
.idea/
# Other files
.DS_Store
Thumbs.db
.coverage
.tox/
.eggs/
Under Django-specific files:
.log
- This contains information about the program's runtime events, such as errors, warnings, and debug messages.pot
- It is short for "Portable Object Template." It contains translatable strings..pyc
- These are compiled Python bytecode files.__pycache__/
- It is a directory that is used by Python to store compiled bytecode files (.pyc
files) for Python moduleslocal_settings.py
- It is a Python file that is used to store local configuration settings for a Django web applicationdb.sqlite3
- This file is created automatically by Django when the project is initialized, and it is used to store the data for the Django models
Under Virtual Environment:
.env
- It is a file that is used to store environment variables for a project.venv/
andenv/
- These are directories that are used to store a Python virtual environment
Under PyCharm-specific files:
.idea/
- PyCharm project configuration directory
.DS_Store
: A file created by macOS to store metadata for a directoryThumbs.db
: A file created by Windows to store thumbnail images for a directory.coverage
: A file created by thecoverage
Python package to store code coverage data.tox/
: A directory created by thetox
Python package to store test environments.eggs/
: A directory created by thesetuptools
Python package to store eggs (zipped Python packages)
You can use this template as a starting point, and customize it to fit the specific needs of your project.
Thank you for reading...