we have just started using a git account of our Django website project so that the team can collaborate on the source code.
I have heard different things concerning what should be done with the /media
directory. We currently keep the /static
directory under version control so that the whole project can be cloned and recreated. However, the website also contains a large amount (>400mb) of uploaded images for galleries which will likely grow over time.
Should this be under git also? Is there a reasonable size limit to be aware of when using GIT? And is there some other method for dealing with the /media
folder which is used by the Django community?
Any guidance would be much appreciated.
You should exclude your media folder in the .gitignore. There are some problems.
When you check in the files its possible that they are modified (Upload script) on the server. Then you cannot pull.
when you need your sources you have to download the whole media files.
You must commit new files everytime on your server.
So we use it without media files. But if you have do automatic deployment and enough time you can to it.
Definitely don't put all your uploaded files from the live site in the source code. It's not where they belong. At the very least you should back up your /media directory to an external location e.g. another server, a local NAS, some backup provider etc.
If your development team wants access to the files during development, you should consider putting a small subset of these files in your source tree and using fixtures to create a standard set of test data for the development environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With