Thursday, July 3, 2008

yaml and gae

Yaml (Yet Another Markup Language) is Google's prefered way of dealing with the structure of its web applications and in this case the Google Application Engine.

The documentation I can find is located at;
yaml.org
The getting started guide for configuring an app gives something of an overview.

For some strange reason an example on how to deal with a single static file is not found in the documentation. Looks like I will have to deal with things a little different to the way i am used to.
I also seem to have a problem with mime types using mime_type setting. The mime_type is overwritten by googles settings somewhere along the line.

The app.yaml file is far from alone, there is also settings.py file which is used by python and django also has a settings file (django_bootstrap.py) to add to the mix.
Example django bootstrap file.

Formatting Dates with Django

Simply letting a date field be displayed with django results in something like this;
2008-07-03 09:20:12.019000
Which is quite helpful in the scientific world but it doesn't really add much to a lot of applications other than confusion.
The way to handle dates is to pass them through something of a filter like this;
{{ datefield|date:"d M Y" }} and the output is : 03 Jul 2008

The filter list can be found in the Django documentation;
http://www.djangoproject.com/documentation/templates/#now

The is also a somewhat useful entry I found here on the topic;
http://www.magpiebrain.com/blog/2005/08/21/formatting-dates-with-django/