What is the proper technique for creating and managing complex data models in Django?
Question: I've got a relational database background, know a bit of Python, and am a
complete Django newbie / wannabe. I've been considering doing some projects in
Django. One thing I've noticed, however, is that, in Django, you create your
data model in code rather than with an ER modeling tool (like ERwin or
Embarcadero).

My question is:

Is it possible to import a complex data model (populated or not) into Django
and visualize it with an ER diagram?

Thanks!


Answer: One of the most valuable features of the Django is its ORM and some
`manage.py` commands to help untangle complex data models. If you haven't
explored [django_extensions](https://django-
extensions.readthedocs.org/en/latest/) yet, I think it has what you want:
`manage.py graph_models` gives you a customizable ER diagram of your models. I
use this often when dealing with large databases. I am often required to
import a large DB model (from an existing set of databases) and generate
almost all of the DB model using the django builtin `manage.py inspectdb >
models.py`. And with `graph_models` you can try a variety of layouts and
various amounts of detail to help you see the "big picture." Even if the
ultimate goal isn't to build a Django webapp, I find these tools helpful in
understanding a DB model quickly, especially when you don't have access to the
original DB creator(s) or their reasoning.

