= Do's and Dont's for Application Writers = This is a guide to writing Django applications, the goals I'm aiming for are: * the application should be easy to install for users * the application should play nice with other applications These are the guidelines I would proprose, please comment and discuss. I hope this can become something everyone in the Django community can agree on. Throughout this document I will need to refer to an imaginary application for examples; let's call it mnemosyne, and put it in ibofobi.apps. When I need to refer to paths, I'll use relative paths rooted at the mnemosyne package directory. == Basics == * Your application should be Python 2.3-safe. Notably you should not use {{{@decorator}}}-syntax, instead do this: {{{ def foo(answer): ... foo = decorate(foo) }}} == Templates == * To avoid name clashes with templates from other applications all your templates should go into {{{mnemosyne/templates/mnemosyne/}}}. The {{{mnemosyne/templates}}} directory will need to be added to {{{TEMPLATE_DIRS}}}, which happens automatically if the user has the {{{app_directory}}} template-loader in {{{TEMPLATE_LOADERS}}}, which is the preferred way to handle this. * Your templates should all extend a single {{{base}}}-template specific to your application, in my example it would be {{{mnemosyne/templates/mnemosyne/base.html}}} and all my templates would start with {{{ {% extends "mnemosyne/base.html" %} }}} and the {{{mnemosyne/base}}} template should either be a complete HTML-document, or (and I think this is preferrable) just be {{{ {% extends "base.html" %} }}} (unless you have any pages which should go under the admin, then they should extend {{{admin/base_site}}}.) ''Should I ''s/base/base_site/'' to be consistent with the admin-application? I personally prefer ''{{{bare}}}'' and ''{{{base}}}'' over ''{{{base}}}'' and ''{{{base_site}}}''; they are more concise and they lack the CTS-inducing underscore.'' * Your templates should assume that the site-templates have these blocks for you to fill: * {{{title}}}; obviously, the document's title, must be {{{