Django Extensions provides a bunch of management commands for the Django Framework. One of the most handy is the graph_models command. This command creates a visual representation of the Django models existing in the database.
In order to use this command you need to have Graphviz and PyGraphviz installed on your machine. Graphviz is a package of open-source tools for representing structural information as diagrams of abstract graphs and networks. PyGraphviz is a Python interface for Graphviz and allows you can create, edit, read, write, and draw Graphviz graphs.
Download and install Graphviz from this link: http://www.graphviz.org/Download_windows.php.
I couldn’t install PyGraphviz using easy_install, because it depends on Graphviz, and easy_install doesn’t know where to find Graphviz.
Download PyGraphviz(1.1) from this link: http://networkx.lanl.gov/download/pygraphviz/, and extract it.
Adjust “setup.py” file to reflect your Graphviz instalation.
library_path='C:/Program Files (x86)/Graphviz 2.28/lib/release/lib'
include_path='C:/Program Files (x86)/Graphviz 2.28/include/graphviz'
Normally, you would run python setup.py install to build and install a python application, but in this case we need to do some extra work. Running this command will output an error:
"Unable to find vcvarsall.bat"
To solve this issue, PyGraphviz needs to be compiled with a MSVC or mingw32 compiler. I haven’t found a Windows build for PyGraphviz so the only option was to built this myself.
I have used an older release of mingw because the current one doesn’t support the mno-cygwin argument anymore.
Download and install mingw-get-inst-20100831.exe from this link:
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/
Add mingw/bin directory to the system path.
Change line 285 from “c:\python27\lib\distutils\unixcompiler.py” from
1 | compiler = os.path.basename(sysconfig.get_config_var("CC")) |
to
1 | compiler = "gcc". |
or there will be an error “TypeError: ‘NoneType’ object is unsubscriptable”. Change it back after finishing installing PyGraphviz.
Now it’s time to build PyGraphviz:
C:\pygraphviz-1.1>python setup.py build -c mingw32
library_path=C:/Graphviz/lib/release/lib
include_path=C:/Graphviz/include/graphviz
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\pygraphviz
copying pygraphviz\agraph.py -> build\lib.win32-2.7\pygraphviz
copying pygraphviz\graphviz.py -> build\lib.win32-2.7\pygraphviz
copying pygraphviz\release.py -> build\lib.win32-2.7\pygraphviz
copying pygraphviz\version.py -> build\lib.win32-2.7\pygraphviz
copying pygraphviz\__init__.py -> build\lib.win32-2.7\pygraphviz
creating build\lib.win32-2.7\pygraphviz\tests
copying pygraphviz\tests\test.py -> build\lib.win32-2.7\pygraphviz\tests
copying pygraphviz\tests\__init__.py -> build\lib.win32-2.7\pygraphviz\tests
copying pygraphviz\tests\attributes.txt -> build\lib.win32-2.7\pygraphviz\tests
copying pygraphviz\tests\graph.txt -> build\lib.win32-2.7\pygraphviz\tests
copying pygraphviz\tests\layout_draw.txt -> build\lib.win32-2.7\pygraphviz\tests
copying pygraphviz\tests\unicode.txt -> build\lib.win32-2.7\pygraphviz\tests
running build_ext
building 'pygraphviz._graphviz' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\pygraphviz
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:/Graphviz/include/graphviz -
IC:\Python27\include -IC:\Python27\PC -c pygraphviz/graphviz_wrap.c -o build\tem
p.win32-2.7\Release\pygraphviz\graphviz_wrap.o
pygraphviz/graphviz_wrap.c: In function 'agattr_label':
pygraphviz/graphviz_wrap.c:2855:5: warning: return makes integer from pointer wi
thout a cast
writing build\temp.win32-2.7\Release\pygraphviz\_graphviz.def
C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\pygraph
viz\graphviz_wrap.o build\temp.win32-2.7\Release\pygraphviz\_graphviz.def -LC:/G
raphviz/lib/release/lib -LC:\Python27\libs -LC:\Python27\PCbuild -Wl,-RC:/Graphv
iz/lib/release/lib -lcgraph -lcdt -lpython27 -lmsvcr90 -o build\lib.win32-2.7\py
graphviz\_graphviz.pyd
Copy the contents of the build/lib.win32-2.7 directory(single sub-folder called pygraphviz) into your Python’s site-packages folder.
You can create a PNG image file called my_project_visualized.png with application grouping running the following command:
manage.py graph_models -a -g -o my_project_visualized.png
Django Extensions
Graphviz website
PyGraphviz website
Minimalist GNU for Windows
Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.