An ultra simple blog made with Django

Setting up the GAE SDK and Django Non-rel

— Monday, December 5th 2011

This was relatively painless on the whole. One thing that was really annoying however was an error returned by any DB commands (run from; Exception AttributeError: "'NoneType' object has no attribute 'mkstemp'" in > ignored I struggled with it for ages, only to discover it didn't cause any problems whatsoever and that the actual cause of my troubles was a misspelt module name :( Apparently it's a new error since v1.6.0 of the GAE SDK in combination with the latest Django-nonrel.

I did have a bit of trouble when it came to deploying the app, I had some trouble with building the Datastore Indexes, which meant I had to run "vaccum_indexes". Something I found interesting was that you manage the live app from your local dev version of the app. For instance, the local versions of and app.yaml (and other files) are used to dictate the state of the remote app, therefore there is no need to re-deploy the app if you make changes to these files.

Another issue I got quite stuck with was Django's Sites framework. It would seem that Django-nonrel doesn't setup a SITE_ID when it syncs the DB, other Django's usually do apparently. This puts you in a catch 22 situation when you want to setup the native admin app. In order to run the admin app you need a SITE_ID, but in order to create one you have to be able to log into the admin! Anyway, it's easy enough to overcome when you know how.

And whilst I'm on the topic of the admin, I reckon it's pretty weird to require the admin root URL to end (yes to end!) with a /, ie; (r'^admin/', include(, Again, I thought for ages that I'd broken something when /admin (without the trailing slash) wasn't working :(

Oh and one last thing, I had to override the 'django/contrib/admin/templates/admin/change_list.html' template in my blog app because Django-nonrel can't do aggregate queries. The templates only used when viewing comments in the admin, so it wasn't a show stopper.