Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django media files under GIT

Tags:

git

django

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.

like image 265
Darwin Tech Avatar asked Jul 06 '12 15:07

Darwin Tech


2 Answers

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.

like image 53
René Höhle Avatar answered Nov 17 '22 10:11

René Höhle


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.

like image 23
tomds Avatar answered Nov 17 '22 09:11

tomds