Django miscellany
My colleagues got hit by this issue the other day. It's a definite annoyance, and just for the record here's my version, just on the off chance that os.curdir
is different.
import os this = os.path.dirname(os.path.abspath(__file__)) TEMPLATE_DIRS = ( "%s/jobs/templates" % this, )
On other things I integrated django-openid the other day into a Django site and its really nice. It worked really well, although I do have to find a way of altering the templates to go nicely into my Page Templated site. I do have to put in some work to the login screen. I have to explain the OpenId login, without making it too daunting and provide an easy way to create an account.
Finally I had a quick play with Google maps. Want to show a map based on a UK postcode? How about:
var postcode = "L7 9NJ"; if (postcode != "") { if (GBrowserIsCompatible()) { var map = new GMap2(mapnode); var lookup = new GClientGeocoder(); lookup.setBaseCountryCode('uk'); map.addControl(new GSmallMapControl()); lookup.getLatLng(postcode, function(point){ map.setCenter(point, 12); }); } }
Yay. Not the encoding has to done with setBaseCountryCode as UK
, not .co.uk
or gb
. Otherwise it centres on Germany, not Liverpool.