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
Django cheap-pages
Methods to use when you just want to use the Django dispatcher and there will be no extra business logic in your pages.
In some cases flatpages is too flat, and store templates in DB is too much hassle
>>> url(^name/$,
... direct_to_template,
... {'template': 'name.html'},
... name='name')
can be expressed as:
>>> page('name')
urlpatterns = patterns('', ...)
urlpatterns += build('Regexp', ['page1', 'page2', ...])
- generic
- urlpatterns
- direct_to_template
I couldn't find any code for a blog-style "Read more after the jump," so I made a custom filter. It will look for **<!--more-->** for the jump, like in Wordpress.
In **settings.py** set **READ_MORE_TEXT** to what you want the text of the link to be.
`READ_MORE_TEXT = 'Read more after the jump.'`
When you call the filter in your template, pass it the absolute link of that entry. Of course, you have to have your **get_absolute_url** function defined in your model, but you should have that already, right? :P
In this example **entry.body** is the content of the blog entry.
`{% load blog_filters %}`
`{{ entry.body|read_more:entry.get_absolute_url }}`
If anyone has a better way to do this, it is, of course, welcome.
- template
- filter
- blog
- find
- jump
- read
- more