On Sun, Nov 11, 2012 at 5:09 PM, Justin Holmes <
jus...@justinholmes.com> wrote:
> My sense is that there are a growing number of use cases, but the one that I
> currently have in mind is for django-coldbrew. I want to be able to
> compile all the coffeescript in a project during the collectstatic process.
> Currently, we have a management command, "collect_coldbrew" - but I'd like
> to allow users to have this occur automatically during collectstatic.
In this case it seems you could just override the collectstatic
command. That's what contrib.staticfiles does with runserver, which is
a core command that gets overridden when you add the staticfiles app
to your INSTALLED_APPS.
From the get_commands [0] code it looks like the last app in
INSTALLED_APPS takes precedence, so adding 'coldbrew' after
`staticfiles` in INSTALLED_APPS would override the default
collectstatic command with coldbrew's extended version.
[0]
https://github.com/django/django/blob/master/django/core/management/__init__.py#L79-123
Bruno