Skip to main content

How to generate class diagrams pictures in a Django/Open-edX project from console

A class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations (or methods), and the relationships among objects.

https://github.com/django-extensions/django-extensions
Step 1:  Install django extensions

Command: pip install django-extensions

Step 2: Add to installed apps


INSTALLED_APPS = (
    ...
    'django_extensions',
    ...
)

Step 3: Install diagrams generators
You have to choose between two diagram generators:
  • Graphviz or
  • Dotplus
before using the command or you will get:

python manage.py graph_models -a -o myapp_models.png

Note: I prefer to use pydotplus as it easier to install than Graphviz and its dependencies so we use pip install pydotplus.

Command:  pip install pydotplus

Step 4: Generate diagrams
Now we have everything installed and ready to generate diagrams using the command python manage.py graph_models



Command  :: 
python manage.py graph_models -a -o myapp_models.png




This will give use the entire Wagtail class diagram:

Thank for visiting :)




Popular posts from this blog

How to read or extract text data from passport using python utility.

Hi ,  Lets get start with some utility which can be really helpful in extracting the text data from passport documents which can be images, pdf.  So instead of jumping to code directly lets understand the MRZ, & how it works basically. MRZ Parser :                 A machine-readable passport (MRP) is a machine-readable travel document (MRTD) with the data on the identity page encoded in optical character recognition format Most travel passports worldwide are MRPs.  It can have 2 lines or 3 lines of machine-readable data. This method allows to process MRZ written in accordance with ICAO Document 9303 (endorsed by the International Organization for Standardization and the International Electrotechnical Commission as ISO/IEC 7501-1)). Some applications will need to be able to scan such data of someway, so one of the easiest methods is to recognize it from an image file. I 'll show you how to retrieve the MRZ infor...

Offline Python Deployments With Docker

Objectives By the end of this post, you will be able to… Describe the difference between a Python wheel and egg Explain why you may want to build Python wheel files within a Docker container Spin up a custom environment for building Python wheels using Docker Bundle and deploy a Python project to an environment without access to the Internet Explain how this deployment setup can be considered immutable Scenario The genesis for this post came from a scenario where I had to distribute a legacy Python 2.7 Flask app to a  Centos  5 box that did not have access to the Internet due to security reasons. Python wheels (rather than eggs) are the way to go here. Python wheel files are similar to eggs in that they are both just zip archives used for distributing code. Wheels differ in that they are installable but not executable. They are also pre-compiled, which saves the user from having to build the packages themselves; and, thus, speeds up the installation process....