Friday, December 17, 2010

Keep synced production media files with your development environment- the "dirty" way

As I wrote in previous post, it's really problem personally for me to keep synced media between dev and production environment. I don't examine cases when on production available really a lot of data.

Copy user-related media files – usually solved via ignore files, symlinks etc. but there is NO STANDARD or SOLUTION - Unsolved
Quick and dirty solution:
# 1) go to parent folder of your 
# static_media (usually project's root folder)

# 2) execute
rsync -avzu -e ssh mylogin@remotehost:~/path/to/static_media ./

 And execute it every time you need have synced media files with your remote host. 

 I've hacked previous version of script to exclude files which already in git repo.
rsync -avzu echo `git ls-files | \
   grep static/ | \
   xargs -I file echo --exclude="file"` \
   -e ssh mylogin@remotehost:~/path/to/static_media ./

No comments:

Post a Comment