Reusable Apps can be Reusable or Not

I have heard it said that Django reusable apps are not. On some level, I agree with this. On another, I disagree. Reusable apps need can be reusable if done right.

The biggest thing that make a non-reusable app is bad documentation. If documentation doesn’t say how to integrate the app, it is not reusable. There are several important things to document with reusable apps.

  • Are any settings needed in
  • Are there any signals raised by the app? How are they used?
  • Does the app catch any signals?
  • Does the app include middleware that needs to activated?
  • If middleware is needed, how does it fit in the middleware order?
  • Does it define its own URLs, views, models, and templates?
  • If I have to define any of these, what is needed to make them work?
  • Does the app provide any management commands?

Templates are a big concern when I look at reusable apps. Many times provided templates don’t fit into my site, and I have to rewrite them. When I do this, I want to know what template tags are available. I want to know what context variables are set in the template. If there is a form, I want to know about the fields. I want to know which fields are required and how they are validated. If I have to process the form in my view, I want to know what needs to be done.

Ok, I thought I had more to say, but I guess that is all I can think of. I wanted to write more about if the app tries to do more than a single thing or if the app has dependencies on a lot of other apps that conflict with other apps that I already have, like using a different migration app than I am. But I can’t think of worthwhile arguments for ┬áthese issues. Just trust me that it matters.

In the end, a well documented app makes it more reusable. Just like any other piece of software.

One Response to “Reusable Apps can be Reusable or Not”

  1. Jens Knutson Says:

    Seems like this would be a good contribution to the Django community, if you made the above blog post into a more formalized checklist of “Things to Document for Your Django Reusable App”.