[Solved]-What type files should be put into .gitignore file in Django project

25👍

There is a popular web service called Gitignore.io that help developers generate gitignore files for popular framework and languages. You can see the Django one here.

*.log
*.pot
*.pyc
__pycache__/
local_settings.py
db.sqlite3
media

On top of that I would also recommend you to ignore things environment items such as virtualenv, or .env files that are related to the local environment that the code is being run from. This also allow you to store passwords and secrets in environment files, and keep them out of your git repo.

.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

Lastly I would also add the django static folder to the list of files to ignore since it is collected with collectstatic whenever you deploy your code.

Leave a comment