docs/sync_s3.rst
:synopsis: sync your MEDIA_ROOT and STATIC_ROOT folders to S3
Django command that scans all files in your settings.MEDIA_ROOT and settings.STATIC_ROOT folders, then uploads them to S3 with the same directory structure.
This command can optionally do the following but it is off by default:
::
$ ./manage.py sync_s3 mybucket
::
$ ./manage.py sync_s3 mybucket --gzip --expires
::
$ ./manage.py sync_s3 mybucket --media-only # or --static-only
::
$ ./manage.py sync_s3 mybucket --media-only --s3host=cs.example.com --acl=private
This management command requires the boto library and was tested with version 1.4c:
It also requires an account with Amazon Web Services (AWS) and the AWS S3 keys. Bucket name is required and cannot be empty. The keys and bucket name are added to your settings.py file, for example::
AWS_ACCESS_KEY_ID = '' AWS_SECRET_ACCESS_KEY = '' AWS_BUCKET_NAME = 'bucket'
It is possible to customize sync_s3 directly from django settings file, for example::
AWS_S3_HOST = 'cs.example.com' AWS_DEFAULT_ACL = 'private' SYNC_S3_PREFIX = 'some_prefix' FILTER_LIST = 'dir1, dir2' AWS_CLOUDFRONT_DISTRIBUTION = 'E27LVI50CSW06W' SYNC_S3_RENAME_GZIP_EXT = '.gz'