Wednesday, November 14, 2007

Django is “order sensitive”

Sometimes I forget that django's is a Python script, and not a plain configuration file. And forgetting it causes django to behave unexpectedly. A couple of examples that happened to are related to array sorting.

Some days ago I customized middleware classes, and after that I left on my


With it, LocaleMiddleware doesn't work, because it requires SessionMiddleware that isn't loaded when LocaleMiddleware is executed.

Today's issue was something similar, but with templates. I customized some admin templates, copying them to a directory loaded with filesystem loader. My looked like:


With it, loaders looked first to application template directories, including the admin ones, so overriding template was never used.

1 comment:

  1. [...] Garcia wrote an interesting post today on Django is