Blog

Generating ERD for Django Applications

Generating an ERD (Entity Relationship Diagram) can be helpful to understand what your database looks like, and is also really easy to generate if you’re running a Python/Django Application.

Step 1: Install django-extensions and graphviz

 pip install django-extensions && pip install graphviz

Step 2: Add django_extensions to settings.py

INSTALLED_APPS = [
    ...
    'django_extensions',
    ...
]

Step 3: Create the .dot output and convert to .png

Run manage.py graph_models from the environment you may normally use:

python manage.py graph_models -a > output.dot

From your mac, change the format to png using graphviz

brew install graphviz
dot -Tpng output.dot -o output.png

Note You can also output to pdf by changing the type:

dot -Tpdf output.dot -o output.pdf

References
Django Extensions graph_models docs
Django Extensions Commands Unavailable?
Opening .dot files on mac

Monthly Goals

Work takes time. Time is money. All of these things should be obvious by now.

But how do you decide how to spend your time or money?

Spend time identifying the most high value opportunities that you can spend your time with. Then divide and conquer.

“Deadlines are vitamins for creativity”

Set monthly objectives. Everyone gets all hot and ornery about new years resolutions, but every turning of the calendar month should bring the same contemplation. This gives you 12 opportunities a year to assess where you’re at, where you’re going, and where you want to get to. Make it a regular practice.

The Best Hatchet

I once worked for a zombie startup*.

At one point, the “leadership” team decided they needed to just get away and do some real soul searching. A candid mandate was issued that everyone read Creativity Inc in the next three days.

They travelled to an old west dude ranch in Arizona, the team met to discuss the changes that had already taken place: The removal of the CIO and COO, as the company tightened its belt in a desperate attempt to “get organized” and “make a plan”.

Someone was ordered to pick up a dozen hatchets from the general store for the meeting. On each hatchet, each “leader” was to name their hatchet with sharpie marker. Later on the team would proceed out into the desert where they would burry all of their hatchets. (A team building exercise that had clearly been recommended by the business coach).

As I was the most senior technology person on staff following the dismissal of the CIO, I wasn’t invited to the meeting. But the hatchets showed up on Monday at the office. Intrigued, I picked up the first one I came across.

Written across the face of the hatchet in the CEO’s handwriting, “The Best”.

Either the team couldn’t figure out how to dig a hole in the desert (possible) or they were too lazy to try (likely).

Either way, The Best™ hatchet is still doing fine work for me.

*Disclaimer: Nothing in this article should be construed as a recommendation to bring a hatchet to a zombie fight.