djangosnippets.org: Latest snippets tagged with 's3'http://djangosnippets.org/tags/s3/2013-02-04T13:48:40.820703-06:00Custom collectstatic that uses etag and md5 digests to determine whether files on S3 have changed
2013-02-04T13:48:40.820703-06:00millarmhttp://djangosnippets.org/snippets/2889/<p>For use with S3 BotoStorage</p>
<p>STATICFILES_STORAGE ="storages.backends.s3boto.S3BotoStorage"</p>
<p>and</p>
<p>AWS_PRELOAD_METADATA = True</p>
<p>Custom management command that compares the MD5 sum and etag from S3 and if the two are the same skips file copy.</p>
<p>This makes running collect static MUCH faster if you are using git as a source control system …</p>
Freely redistributableAmazon S3 browser-based upload form(FIXED)
2012-10-04T00:15:15.796957-05:00grillermohttp://djangosnippets.org/snippets/2829/<p>This is a 'fixed' version of snippet <a href="http://djangosnippets.org/snippets/1868/">1868</a>
Changes:
<em>Correctly handle the Content-Type, because amazon requieres it to be named with a dash and we can't use dashes in the form attributes declaration.
</em>Also added max_size handling, with the corresponding update to the policy generation.
*Added an example usage with …</p>
Freely redistributableAmazon's CloudFront streaming signed urls
2010-08-27T07:17:05.388542-05:00sayanehttp://djangosnippets.org/snippets/2175/<p>You can use this code to sign urls for streaming distributions or change it a bit and sign normal distribution's urls.
</p>
<p>Available settings:
</p>
<p>CLOUDFRONT_KEY - path to private key file
CLOUDFRONT_KEY_PAIR_ID - key pair id
CLOUDFRONT_EXPIRES_IN - expiration time in seconds
CLOUDFRONT_DOMAIN - domain name
</p>
Freely redistributableAmazon S3 Enabled FileField and ImageField (with Boto)
2010-04-04T10:47:04.065903-05:00natebeachamhttp://djangosnippets.org/snippets/1976/<p>Allows Amazon S3 storage aware file fields to be dropped in a model. Requires the boto library.</p>
Freely redistributableAmazon S3 browser-based upload form
2010-01-15T06:35:55.839934-06:00simonhttp://djangosnippets.org/snippets/1868/<p>A Django Form for creating a browser-based upload form that pushes files to Amazon S3. See http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1434</p>
Freely redistributableSorl Thumbnail + Amazon S3
2009-06-10T22:28:44.272537-05:00skoczenhttp://djangosnippets.org/snippets/1562/<p><strong>General notes:</strong></p>
<ul>
<li>
<p>Set MEDIA_URL (or whatever you use for uploaded content to point to S3 (ie. MEDIA_URL = "http://s3.amazonaws.com/MyBucket/"))</p>
</li>
<li>
<p>Put django-storage in project_root/libraries, or change the paths to make you happy.</p>
</li>
<li>
<p>This uses the functionality of django-storage, but <em>not</em> as DEFAULT_FILE_STORAGE. </p>
</li>
</ul>
<p>The functionality works like so:</p>
<p><strong>Getting stuff to S3 …</strong></p>
Freely redistributableS3 static media uploader
2008-12-01T01:18:02.745625-06:00phlexhttp://djangosnippets.org/snippets/1227/<p>This is a bastardisation of a few of the Amazon s3 file uploader scripts that are around on the web. It's using Boto, but it's pretty easy to use the Amazon supplied S3 library they have for download at <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134">their site</a>.
It's mostly based on <a href="http://www.holovaty.com/blog/archive/2006/04/07/0927">this</a> and <a href="http://www.davidcramer.net/code/112/writing-a-build-bot.html">this</a>. …</p>
Freely redistributableSecurely Signed S3 Links With Expiration
2008-11-08T12:07:45.585707-06:00pjshttp://djangosnippets.org/snippets/1174/<p>I couldn't find a Python implementation of this, so I threw this class together real quick.</p>
<p>This will let you share "private" files on S3 via a signed request. It will also have an expiration on the link, so it is only valid until a certain time period.</p>
<p>Example Usage: …</p>
Freely redistributable