Skip to content

Instantly share code, notes, and snippets.

@santoshpy
Last active February 11, 2026 10:36
Show Gist options
  • Select an option

  • Save santoshpy/6f982faf1eacdac153ffd86a3a694239 to your computer and use it in GitHub Desktop.

Select an option

Save santoshpy/6f982faf1eacdac153ffd86a3a694239 to your computer and use it in GitHub Desktop.
gitignore file for django project
*.pyc
db.sqlite3
*.db
media/
static/
__ pycache __
.DS_Store
**/migrations/**
!**/migrations
!**/migrations/__init__.py
@bouwehand
Copy link

nice! tnx!

Copy link

ghost commented Aug 8, 2020

Great. Thanks for the file.

@ayush-mandowara-bst
Copy link

Hi, why do you have migrations in your .gitignore file?

@santoshpy
Copy link
Author

Hi, why do you have migrations in your .gitignore file?

if you are working on the git and sometimes you get a lot of git issues due to migration conflicts in development. It's not recommended for production.

@opeerator
Copy link

Migration files are part of the code base and should be committed.

@santoshpy
Copy link
Author

Migration files are part of the code base and should be committed.

Hello @opeerator

I agree but in some cases, due to migration conflict, I chose to ignore it.

@anton-adamiv
Copy link

Hello @santoshpurbey
What about data migrations?

@iamnur
Copy link

iamnur commented Aug 22, 2020

Awesome

@santoshpy
Copy link
Author

Hello @santoshpurbey
What about data migrations?

Thank you for pointing import stuff about database migrations, I've created this gist for my use-case where I've faced migrations issue while working with git so I put it in git ignore file but aware of this and only useful for development environment but not for production where we need the most. Interesting fact: unexpectedly this gist appeared on top in google search.

@bphariharan1301
Copy link

I have named my virtualenv in a different way like Eg: blogenv. So, how can I add that to gitignore file??
Can anyone help me out Please.....

@shahid-ullah
Copy link

shahid-ullah commented Oct 3, 2020

@bphariharan1301

I have named my virtualenv in a different way like Eg: blogenv. So, how can I add that to gitignore file??
Can anyone help me out Please.....

blogenv/

@MrKyHn1
Copy link

MrKyHn1 commented Jan 8, 2021

Hello, i have site-packages and py_cache files, should i ignore them on my gitignore, besides poluting my git status i feel like it is not necessary files, they should only remain on the user's side. What do you guys think ?

@MrKyHn1
Copy link

MrKyHn1 commented Jan 8, 2021

to be more precise they are /py_cache files and venv/lib/python/site-packages/ but i notice that you ignore the venv folder , we use a common venv in my team to not flood our machines and it works fine

@ayush-mandowara-bst
Copy link

ayush-mandowara-bst commented Jan 8, 2021 via email

@MrKyHn1
Copy link

MrKyHn1 commented Jan 8, 2021

I mean the venv is on the repo when you clone it. I am gonna remove it like suggested, but i would like to make a script to create the venv( i mean the activate/deactivate/... Binaries and so on)

@ayush-mandowara-bst
Copy link

ayush-mandowara-bst commented Jan 8, 2021 via email

@MrKyHn1
Copy link

MrKyHn1 commented Jan 8, 2021

Thanks a lot! Have a nice evening :)

@BukhosiMoyo
Copy link

Thank you so much this is really helpful...

@ilyas-shah
Copy link

thanks!

@VladimirChukavin
Copy link

It's great, thanks!

@zamaniamin
Copy link

Thanks it is really useful!

@AlexKozhanov
Copy link

Hi, thanks!

@Hamza-benfaddoul
Copy link

nice thanks

@hab2bulo
Copy link

thanks

@sjthesahiljoseph
Copy link

Thanks man !!

@PhinehasdFalken
Copy link

Thanks buddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment