I just noticed a Request for Comments: Auto-Installation of Apps in Django by Corey Oordt, which ties in with something I’ve been meaning to finish up and publish.

Some time ago, I blogged about Pluggable Django and How I hate repetiting myself. That was mostly about current but messy code I was using, which allowed me to automatically add decoupled apps to a django project without having modify the rest of my django project each time. Apps were auto-detected, and loaded, including templates etc.

Since then, I’ve been re-working this code a little. It hasn’t been high priority, since django is not a tool I’ve needed on current projects, but I did manage to get something up on github a few days back:

So basically, these are git repositories for “django-admin startproject” and “./manage.py startapp” replacements. To start a project, just clone the Blitzen project url, and to create an app within that, clone the Blitzen app url. Note that most of the new code here is in a directory called quickening, which was a previous working title for this stuff.

So what does it do? Well, currently, not as much as my old code, in that it doesn’t really handle templates etc. just yet (the code might be there for that, but it’s untested). Things you’ll notice:

  • settings.py is a lot more manageable. Most of the complex config is moved into the library code and called
  • Load order of middleware is worked out automatically, by specifying dependencies. Code for this is very straightforward, in quickening/deps.py, with the dependencies currently in quickening/apps.py
  • If I recall correctly, app dependencies aren’t handled yet, but the middleware dependency code was written to also support automatic dependency resolution for apps, including specifying dependencies within an app itself, rather than in the project that hosts an app. More work on this is probably required.
  • there is no default SECRET_KEY any more. Instead, secret keys are auto-generated and kept in files which are ignored by git, meaning that when you checkout the code, or push the code to a webserver, each new instance gets its own key automatically.
  • sqlite is configured by default

Ideas, suggestions, flames, code, etc. welcome :)

Tags: , , , , , , , , , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">