File Extensions

Problem

I created a pure HTML Cheetah test.tmpl file, and compiled it to test.py. When I tried to visit the url "~MyContext/test", I got a 404 error. But if I went to "~MyContext/test.py", the page is returned correctly. Why is this happening?

Solution

IanBicking wrote:

Maybe because there's an ambiguity of what file you are calling -- test.tmpl or test.py. When you give the extension it is unambiguous.

I thought Webware would ignore the unregistered extension, though.

ChuckEsterbrook wrote:

Actually, it's the other way around. You have to specify what extensions to ignore. An old TO DO item is to switch WebKit to a setting called ExtensionsToServe.

But in the mean time, go to WebKit/Configs/Application.config and add .tmpl to the ExtensionsToIgnore setting.

I (Edmund) add:

It's not enough to do this. You must also add things like .tmpl~ (backup files created by emacs, in my case) to the ExtensionsToIgnore setting, or you will still get 404 errors.

-- EdmundLian - 02 Dec 2001

I noticed also that Cheetah leaves _bak files around, too, so I needed to add .py_bak to the list of extensions to ignore. This may be a problem if you regenerate an HTML file with Cheetah, too (meaning, .html_bak would need to be ignored, too).

-- DavidHancock - 07 Jul 2002