djangosnippets.org: Latest snippets tagged with 'amazon'https://djangosnippets.org/tags/amazon/2013-12-11T15:47:24.581181-06:00Decorator to execute a method only once
2013-12-11T15:47:24.581181-06:00atodorov-otbhttps://djangosnippets.org/snippets/3010/<p>Beware if using Amazon Simple Queue Service to execute Celery tasks which send email messages! Sometimes SQS messages are duplicated which results in multiple copies of the messages being sent. This is a simple decorator which uses a cache backend to prevent the task from executing twice in a specified …</p>
Freely redistributableCustom collectstatic that uses etag and md5 digests to determine whether files on S3 have changed
2013-02-04T13:48:40.820703-06:00millarmhttps://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:00grillermohttps://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:00sayanehttps://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:00natebeachamhttps://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 product-data interface class for Django-friendly PyAWS queries
2010-01-25T23:28:54.463741-06:00fish2000https://djangosnippets.org/snippets/1889/<p>I am not sure what to say about the state of PyAWS, or its future, what with the multiple forks available and lack of recent updates. The best version I've found is <a href="this one">http://github.com/IanLewis/pyaws</a>, a spiffed-up version of 0.2.2 by Ian Lewis. I wrote this class on top of PyAWS …</p>
Freely redistributableAmazon S3 browser-based upload form
2010-01-15T06:35:55.839934-06:00simonhttps://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:00skoczenhttps://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:00phlexhttps://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 redistributable