Package: django-boto
# Django-boto[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/qnub/django-boto?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)Is an implementation ofDjangointegration with [Amazon AWS](http://aws.amazon.com/)
services through [boto](https://github.com/boto/boto) module.# InstallationTo install:easy_install django-botoor:pip install django-boto# Configuration## DEFAULT_FILE_STORAGECan’t be used as default file storage system because ofpathnot
implemented but you still can passS3Storageobject as storage
option to aFileField:from django.db import models
from django_boto.s3.storage import S3Storages3 = S3Storage()class Car(models.Model):…
photo = models.ImageField(storage=s3)## Other settings.py optionsAWS_ACCESS_KEY_ID(required for default file storage use)Access Key IDfromSecurity Credentialssettings on AWS service. Required for using
as default storage.AWS_SECRET_ACCESS_KEY(required for default file storage use)Secret Access KeyfromSecurity Credentialssettings on AWS service. Required for using
as default storage.AWS_ACL_POLICYDefault canned ACL for objects saved. Defaults topublic-read.BOTO_S3_BUCKETAmazon S3bucketname. Default set toAWS_ACCESS_KEY_ID.BOTO_S3_HOSTAmazon S3 hostname. Default tos3.amazonaws.com.BOTO_BUCKET_LOCATIONAmazon datacenter location. Default toUS Classic Region.AWS_S3_FORCE_HTTP_URLDefault toFalse. This settings allow you forcing S3 to return http links to files (if you have problem with SSL).# Usage## Manual S3Storage usageIf you need to use it manually - you can passbucket_name(asBOTO_S3_BUCKET),key(asAWS_ACCESS_KEY_ID),secret(asAWS_SECRET_ACCESS_KEY) andlocation(asBOTO_BUCKET_LOCATION) directly to storage constructor:from django_boto.s3.storage import S3Storages3 = S3Storage(bucket_name=’another-bucket’, key=’another-key’,secret=’another-secret’, location=’EU’)S3Storageis a typical [Django storage system](http://readthedocs.org/docs/django/en/1.4/ref/files/storage.html#the-storage-class), onlypathis not implemented andcreated_timeandaccessed_timereturn
same value asmodified_time.## Upload shortcutYou can use a shortcut for simple uploads:from django_boto.s3 import uploadupload(filename, name=None, prefix=False, bucket_name=False, key=None,secret=None, host=None, expires=0, query_auth=False, force_http=True,
policy=None)where:filename:stringfilesystem path to file ordjangoFileinstance
orpythonfileobject instance;name:stringtarget Django’s name for uploading the file;prefix:stringpath prefix to filename ins3.amazonaws.comurl. Like
filename/images/image.jpgwithavatarsprefix convert toavatars/image.jpgin amazon url;bucket_name:name of bucket (if not exists - system try to create it) in amazon
S3;key:AWS_ACCESS_KEY_IDreplacement;secret:AWS_SECRET_ACCESS_KEYreplacement.host:BOTO_S3_HOSTreplacement.expires:intHow long should private links be valid for.query_auth:boolShould the url be generated with a valid signature?
Required for private files.force_http:boolShould the generated url be http?policy:stringCanned acl string for uploaded objects.Last nine options are optional. If not set - it’s taken from thesettings.pyor defaults are used.upload()returns a generated URL for a file download.