Reusable apps for Django

Tom Sleebe
Sanoma Technology Blog
3 min readApr 4, 2017

At the first day of DjangoCon Europe 2017, Flávio Juvenal da Silva Junior talked about the qualities an django app should have to become a “great reusable app”.
You can checkout his slides or view the website he created which contains the checklist.
Although the checklist could be interesting in and of itself, it’s actually just a checklist to make sure you didn’t do anything stupid.

Small introduction

The talk mainly focused on the technical and community aspect of building a reusable django app. The shortest summary is it consist of the following aspects:

  1. Concept
  2. Easy to install
  3. Easy to use
  4. Easy to integrate
  5. Maintenance

In the concept phase we should follow the UNIX philosophy: “Do one thing and, do it well” and think of a single line description that states what the django app actually does.
Basically everything after the concept phase becomes technical and focuses on the community aspect. As is required by the Django Community you should make sure you have documentation available, your app has tests etc.

Thought process

What it did though is got me thinking, when does an django app has the potential to become a “great reusable django app” and when should I build a reusable django app.

Sure the the checklist talks in its intro about following the UNIX philosophy and check if you can describe the functionality in a few words but what does that give us?

Well it give us two entry points: 1. Create a django app which does one thing really well and 2. A key focus the it should have.
But with these two points we could still write an django app which is actually not reusable at all.

For example if we would write an django app for filling in a grid where certain grid positions are “special” in some way, shape or form (maybe position 2,4,6,8 and 10 are bigger pictures).

Sure the filling of a grid is reusable but not every application has a dynamic grid with “special” positions.

Or maybe even an django app to calculate certain statistics from some data input source, chances are that the data supplied to the app will differ from website to website and possibly even the statistics you want out of them.

Closing thoughts

The weird part about all of this is, that I couldn’t come up with a single answer or checklist as to when an django app should be developed as a reusable one.
Since you can view it in a way like “you should be able to drop it in and it will start doing it’s job”.

But if we keep that concept in mind a lot of great reusable app like the Django Rest framework, django-mptt, django-extensions etc. basically would fallout of that category, since you need to do configuration and specifications within your django app to make sure it works correctly.

Maybe we could think about a reusable django app as an app which gives us functionality you would like to use more often and is made useful through small configuration changes and maybe extending your own model?

Maybe we should just start to create a reusable django app when you’ve got the request to build a certain feature a lot or when you’ve got a couple of sites you maintain and half of them use the same functionality?

Although if we take into account that certain functionalities aren’t that useful as a reusable django app, it isn’t a bad thing to at least follow the introduction of the reusable django app.
Namely the 2 entry points mentioned above, just to really make you think about what you are going to build and how you are going to achieve that goal.

--

--