21👍
You could consider a gitignore
tailored for Django project instead.
And don’t forget that, if you already have added and committed a folder content, you will need to remove them before your .gitignore can take effect.
git rm --cached -r afolder/
However, by default, migration
is not ignored. (you can skip some of those migration steps)
As pointed out by Ora in the comments, see "Should I be adding the Django migration files in the .gitignore
file?".
So, do not add migration/
to your .gitignore
.
3👍
The best example I have found is here: https://djangowaves.com/tips-tricks/gitignore-for-a-django-project/
This is not my work!!! I don’t want to take credit for someone else’s good collection! Not everything in there is relevant. The author documents it well, though, so you can boil it down to what you need.
I would also add:
**/migrations
*.DS_Store
**/__pycache__
**/.DS_Store
- In Django how do I notify a parent when a child is saved in a foreign key relationship?
- Can't pip install mysql-python
- CSV file upload from buffer to S3
- How to write a Django view for a POST request
0👍
I actually don’t know how did you add migrations
directories. If you already committed to git with those directories, then simply add migrations/*
to .gitignore
and delete all the migrations folder. Then commit and push. After this, you will never see any migrations
changes to git until you forcefully staged and commit.
- Django: check for modeladmin for a given model
- Make Django return response as a "different filename"