Optional Django Apps标签：python, django, hacks
A project of mine contains a number of third-party apps that are development
related and potentially not available on every machine the project will run
on. My general approach to dealing with these was to try and import the app in
settings module and if successful, add it to the
setting. However as the number of these apps grew it became a wart within the
settings module so I put together this snippet for managing them.
We first create a sequence of dictionaries, each containing information about
an installed app such as the module to try and import, an extra potential
condition for checking and then the sequences of names to add to
Let’s start with the settings for optionally including the apps django-
Next we simply iterate through the sequence of optional apps and set them up.