.gitignore when setting up a django project

Hi All

When creating a new django project is there a popular minimal .gitignore boilerplate that people use?

Do you copy and paste from somewhere? If so where? What is best practice here?

I know the Django project recommends using .git/info/exclude instead, but is that purely because it is such a popular open source project?

What do you do?

I’ve searched for gitignore on django docs and there is no reference. Perhaps there could be to help new developers?


I pretty much google “Python gitignore” whenver I start a new project (that doesn’t use a template). This example should cover the needs of the majority, while the rest can be added as needed.

As an aside, I think it’s good practice to consider if a certain ignore can be globally configured and not always defaulting to cluttering up the .gitignore file.

Hope it helps!

I use gitignore.io with the language, framework, editor, etc I’m using in the project.


I use the file suggested by GitHub. They allow selection when creating a new repo or you can copy them from this repo: https://github.com/github/gitignore

I’d mirror @alchermd and say a global gitignore is a key thing for you, and your team mates to configure. It’s far better that each dev configures their local git once to not clutter up repos with their particular tools’ project files than for each repository to list all the project files to ignore.

The django docs are source control system agnostic (asides from the contributing guide). Django itself has already seen subversion come and go. Any git documentation we’d put up would be liable to bitrot with changing tides or develpoments in git.

Where is this recommendation? .git/info/exclude seems to be local only and won’t be shared with other team members.

Three excellent prompt responses.

Thank you all :ok_hand: