Login

Snippets by phlex

Snippet List

S3 static media uploader

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 [their site](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=134). It's mostly based on [this](http://www.holovaty.com/blog/archive/2006/04/07/0927) and [this](http://www.davidcramer.net/code/112/writing-a-build-bot.html). It's fairly limited in what it does (i didn't bother os.walking the directory structure), but I use it to quickly upload updated css or javascript. I'm sure it's a mess code wise, but it does the job. This will first YUI compress the files, and then gzip them before uploading to s3. Hopefully someone might find this useful. It will also retain the path structure of the files in your MEDIA_ROOT directory. To use it, set up your Amazon details, download the [YUI Compressor](http://developer.yahoo.com/yui/compressor/), and then enter the folder you wish to upload to s3, and basically run the script - python /path/to/s3_uploader.py

  • s3
  • amazon
Read More

URL based breadcrumbs

This is a simple URL based breadcrumb filter I'm using on a site I'm currently building. To use it, just throw the code into template-tag file, and simply pass the current url in a page template like so {{ request.get_full_path|breadcrumbs }} As an example of how to style it, wrap it in a unordered list with an id of breadcrumb, and then in your styles use #breadcrumb li { display: inline; }. On a contact form for a site user, this will produce something along the lines of you are here : [home](/) » [users](/users/) » [username](/username/) » contact form Hopefully someone may find it useful.

  • filter
  • breadcrumbs
Read More

phlex has posted 2 snippets.