Thursday, June 26, 2008

Django includes

Another problem which has irked me in recent days is including another file within the one I am displaying.
If I use the include statement in a page which is used by django like
this;
{% include "includes/footer.html" %}
I need to change it to look like;
{% include "static/includes/footer.html" %}
What do I need to edit within django so it can represent or look
similar to changes I have made to the app.yaml file?
- url: /includes
static_dir: static/includes

While this is something of a fixable problem it is exacerbated when theapplication is loaded onto the Google appspot and the the file to include is ignored even though the file is present.

Filenames and case sensitivity.

If a reference an image from my local machine(windows) I have no problem accessing a filename such as: FileName.jpg even if the name of the file is filename.jpg.

Luckily it was a small problem to fix and caused no major problem other than a couple of minutes type fixing the variables with the .lower() command in python.

Monday, June 9, 2008

Favicon with gae

While creating any new web application the one thing which I look at the most is the logs. The logs tend to give me a good idea of what is happening and in my case what I am doing wrong.

One error message which I am getting a lot of is;
INFO 2008-06-09 17:14:37,313 dev_appserver.py] "GET /favicon.ico HTTP/1.1" 404 -

This means a favicon is missing. So I went to the google application website and picked up the favicon and dumped it in my application directory.
http://appengine.google.com/favicon.ico

I also needed to add to the file app.yaml.
- url: /favicon.ico
static_files: static/images/favicon.ico
upload: static/images/favicon.ico

This option allows any images to be automatically shown without having to be processed any further.

A problem which I have found by doing this is the mime_type really needs to be set to something else, but it doesn't seem to work.

You will need to ensure that this statement is placed before others that my overwrite it, so check the order in the yaml file

More about this can be read here;
http://code.google.com/appengine/docs/configuringanapp.html