Development
Amazon S3 Website CNAME
While trying to create an S3-hosted static website I was trying to configure my domain to point to the S3 with a CNAME record on my DNS records for the domain.
The Amazon documentation mistakenly tells you to setup your CNAME to point to something like this:
#this is wrong! my.domain.com CNAME my.domain.com.s3.amazonaws.com. http://my.domain.com/index.html # will work http://my.domain.com/ # will not work
This configuration will not work if you want directories to serve index.html by default. You may notice that if you type the complete URL you will get an S3 “Access Denied” message.
For your bucket, go to: Properties->Website Endpoint: http://my.domain.com.s3-website-us-east-1.amazonaws.com/ You need: s3-website-us-east-1.amazonaws.com
Now you can configure your DNS settings.
# the proper configuration my.domain.com CNAME s3-website-us-east-1.amazonaws.com. http://my.domain.com/index.html # will work http://my.domain.com/ # will work
Insert html django contrib messages
I wanted to use raw HTML in certain invocations of Django’s Messages architecture such as in messages.success.
When sending your message:
messages.success(request, mark_safe("""Thanks for your purchase. Your <a href="%s">Account > Payment</a>""" % urlresolvers.reverse(‘account_payment_detail’, kwargs = {‘id’:payment.id}) ), extra_tags=‘html’)
Modify your Django snippet to skip the web-safe encoding:
{% if ‘html’ in message.tags %}
{{ message|safe }}
{% else %}
{{ message }}
{% endif %}Twitter Bootstrap not working with LESS.js
I was having a problem trying to use “less” (lesscss v1.2.0) with Twitter Bootstrap (v1.4).
I could see LESS pull all the bootstrap *.less files off the server but the CSS would render properly. In many cases it would have the error:
Cannot call method 'slice' of undefined
The reason is a bug in the most recent version of less.js. To resolve the problem I downgraded to “less” v1.1.5
https://github.com/twitter/bootstrap/issues/968
Recent blog posts
- Amazon S3 Website CNAME
- Button labels for checkout
- Insert html django contrib messages
- Twitter Bootstrap not working with LESS.js
- Javascript libs that offer basic subset of jquery features
- Building the donor-matic
- Playing with free Google Map alternatives.
- Some flows are not as complicated as they appear
- Form design crib sheet
- Script to get IE9 Windows Virtual PC images into Virtual Box