File: sync_media_s3.rst

package info (click to toggle)
python-django-extensions 0.4.2pre%2Bgit201004211325-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 768 kB
  • ctags: 739
  • sloc: python: 4,197; makefile: 76
file content (43 lines) | stat: -rw-r--r-- 1,155 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
sync_media_s3
=============

:synopsis: sync your MEDIA_ROOT folder to S3

Django command that scans all files in your settings.MEDIA_ROOT folder and
uploads them to S3 with the same directory structure.

This command can optionally do the following but it is off by default:

  * gzip compress any CSS and Javascript files it finds and adds the
    appropriate 'Content-Encoding' header.
  * set a far future 'Expires' header for optimal caching.


Example Usage
-------------

::

  # Upload files to S3 into the bucket 'mybucket'
  $ ./manage.py sync_media_s3 mybucket

::

  # Upload files to S3 into the bucket 'mybucket' and enable gzipping CSS/JS files and setting of a far future expires header
  $ ./manage.py sync_media_s3 mybucket --gzip --expires


Required libraries and settings
-------------------------------

This management command requires the boto library and was tested with version
1.4c:

  http://code.google.com/p/boto/

It also requires an account with Amazon Web Services (AWS) and the AWS S3 keys.
The keys are added to your settings.py file, for example::

  # settings.py
  AWS_ACCESS_KEY_ID = ''
  AWS_SECRET_ACCESS_KEY = ''