<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yathomasi on Medium]]></title>
        <description><![CDATA[Stories by Yathomasi on Medium]]></description>
        <link>https://medium.com/@yathomasi?source=rss-ff94246f3c0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ODWravJ9_Sp05l-V2yMoiA.jpeg</url>
            <title>Stories by Yathomasi on Medium</title>
            <link>https://medium.com/@yathomasi?source=rss-ff94246f3c0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 11:07:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yathomasi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using django-extensions to visualize the database diagram in django application]]></title>
            <link>https://yathomasi.medium.com/1-using-django-extensions-to-visualize-the-database-diagram-in-django-application-c5fa7e710e16?source=rss-ff94246f3c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5fa7e710e16</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[graph-model]]></category>
            <category><![CDATA[python-pygraphviz]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[django-extentions]]></category>
            <dc:creator><![CDATA[Yathomasi]]></dc:creator>
            <pubDate>Thu, 12 Jul 2018 13:48:45 GMT</pubDate>
            <atom:updated>2025-07-11T06:00:36.642Z</atom:updated>
            <content:encoded><![CDATA[<h3>Visualizing Django Models and Relationships: Exporting Database Diagrams as Images with django-extensions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RJIiCiyqV4HQa9kRlOVsow.png" /><figcaption><a href="https://github.com/simeonf/django-dualdb-sample/tree/master/dualdb">Chinabook Database Model</a></figcaption></figure><p>Drawing a database diagram for your django application can be a lot easier than starting a new drawing app or online sites. This can be achieved by using django-extensions . Django Extensions is a collection of custom extensions for the Django Framework. Among them we will use graph models to get the output of database design in png image format or dot format.</p><p>Search python-pygraphviz package for your OS and install it.</p><p>For MacOS:</p><pre>brew install graphviz</pre><p>For Linux (Ubuntu/Debian):</p><pre>sudo apt install python-pygraphviz</pre><p>For Windows/Ubuntu integration you may need</p><pre>sudo apt install pkg-config</pre><p>Now in your python environment (Virtual environment is recommended)</p><pre>pip install django-extensions pygraphviz</pre><p>and add django-extensions to the installed apps of your django settings.</p><pre>INSTALLED_APPS = [ <br>                   ...<br>                   &#39;django_extensions&#39;,<br>]<br>#ALERT while copying: inverted comma in medium is different</pre><p>Usage Examples:</p><pre>#To group all the application and output into PNG file<br>python manage.py graph_models -a -g -o imagefile_name.png<br><br>#Include only some applications<br>python manage.py graph_models app1 app2 -o app1_app2.png<br><br>#Include only some specific models<br>python manage.py graph_models -a -I Foo,Bar -o foo_bar.png<br><br>#OR exclude certain models <br>python manage.py graph_models -a X Foo,Bar -o no_foo_bar.png</pre><p>If there is problem with pygraphviz ,another method would be to use pydot which can be used to create dot files.</p><pre>pip install pydot pyparsing==1.5.7 #use this specific version (or this issue might have been fixed)</pre><p>Instead of giving output by -o image_name.png ,we can the catch the STDOUT given in a dot file for the same above examples</p><pre>python manage.py graph_models -a &gt; dotfile.dot<br><br>python manage.py graph_models app1 app2 &gt; fire_me.dot<br><br>python manage.py graph_models -a -I Foo,Bar &gt; something.dot<br><br>python manage.py graph_models -a X Foo,Bar &gt; nofoobar.dot</pre><p>these dot file can be edited using this <a href="https://dreampuf.github.io/GraphvizOnline/">GraphvizOnline</a> tool. You can find the nodes by the names and vertices in the relations section and tweak littlebit and get in the format you like(svg,png and many more).</p><p>Also the <a href="https://github.com/django-extensions/django-extensions">django-extensions</a> is collections of extensions and this can come handy for many other purposes.</p><p>Generate (and view) a graphviz graph of app models:</p><pre>python manage.py graph_models -a -o myapp_models.png</pre><p>Produce a tab-separated list of (url_pattern, view_function, name) tuples for a project:</p><pre>python manage.py show_urls</pre><p>Check templates for rendering errors:</p><pre>python manage.py validate_templates</pre><p>Run the enhanced django shell:(you can directly start using models)</p><pre>python manage.py shell_plus</pre><p>Run the enhanced django runserver, (requires Werkzeug install):<br>This one is a cool debugger where you can use shell from browsers.</p><pre>python manage.py runserver_plus</pre><p>Finally. Thanks for reading ❤❤❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5fa7e710e16" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>