METADATA 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. Metadata-Version: 2.1
  2. Name: django-spaghetti-and-meatballs
  3. Version: 0.4.2
  4. Summary: Its a spicy meatball for serving up fresh hot entity-relationship diagrams straight from your django models.
  5. License: MIT
  6. Author: Samuel Spencer
  7. Author-email: sam@sqbl.org
  8. Requires-Python: >=3.6,<4.0
  9. Classifier: License :: OSI Approved :: MIT License
  10. Classifier: Programming Language :: Python :: 3
  11. Classifier: Programming Language :: Python :: 3.6
  12. Classifier: Programming Language :: Python :: 3.7
  13. Classifier: Programming Language :: Python :: 3.8
  14. Classifier: Programming Language :: Python :: 3.9
  15. Requires-Dist: django (>=2.2)
  16. Description-Content-Type: text/x-rst
  17. django-spaghetti-and-meatballs
  18. ==============================
  19. |docs| |travis| |code-climate| |coveralls|
  20. Its a spicy meatball for serving up fresh hot entity-relationship diagrams straight from your django models.
  21. Adding spaghetti to your project
  22. --------------------------------
  23. Install some spaghetti:
  24. .. code-block:: sh
  25. pip install django-spaghetti-and-meatballs
  26. Add ``"django_spaghetti"`` to your ``INSTALLED_APPS`` setting like this:
  27. .. code-block:: python
  28. INSTALLED_APPS = [
  29. ...
  30. 'django_spaghetti',
  31. ]
  32. Configure your sauce
  33. ++++++++++++++++++++
  34. ``django-spaghetti-and-meatballs`` takes a few options set in the ``SPAGHETTI_SAUCE``
  35. variable from your projects ``settings.py`` file that make it `extra spicy`:
  36. .. code-block:: python
  37. SPAGHETTI_SAUCE = {
  38. 'apps': ['auth', 'polls'],
  39. 'show_fields': False,
  40. 'exclude': {'auth': ['user']},
  41. }
  42. In the above dictionary, the following settings are used:
  43. * ``apps`` is a list of apps you want to show in the graph. If its `not` in here it `won't be seen`.
  44. * ``show_fields`` is a boolean that states if the field names should be shown in the graph or just in the however over. For small graphs, you can set this to `True` to show fields as well, but as you get more models it gets messier.
  45. * ``exclude`` is a dictionary where each key is an ``app_label`` and the items for that key are model names to hide in the graph.
  46. If its not working as expected make sure your app labels and model names are all **lower case**.
  47. Serve your plate in your urls file
  48. ++++++++++++++++++++++++++++++++++
  49. Once you've configured your sauce, make sure you serve up a plate of spaghetti in your ``urls.py`` like so:
  50. .. code-block:: python
  51. urlpatterns += patterns('',
  52. url(r'^plate/', include('django_spaghetti.urls')),
  53. )
  54. A sample platter
  55. ----------------
  56. Below is an example image showing the connections between models from the
  57. `django-reversion <https://github.com/etianen/django-reversion>`_ and
  58. `django-notifications <https://github.com/django-notifications/django-notifications>`_
  59. apps and Django's built-in ``auth`` models.
  60. Colored edges illustrate foreign key relations, with arrows pointing from the defining
  61. model to the related model, while gray edges illustrate many-to-many relations.
  62. Different colors signify the different Django apps, and when relations link between
  63. apps the edges are colored with a gradient.
  64. .. image:: https://cloud.githubusercontent.com/assets/2173174/9053053/a45e185c-3ab2-11e5-9ea0-89dafb7ac274.png
  65. Hovering over a model, gives a pop-up that lists the following information:
  66. * model name
  67. * app label
  68. * The models docstring
  69. * A list of every field, with its field type and its help text (if defined). Unique fields have their name underlined.
  70. This was build with the sauce:
  71. .. code-block:: python
  72. SPAGHETTI_SAUCE = {
  73. 'apps': ['auth', 'notifications', 'reversion'],
  74. 'show_fields': False,
  75. }
  76. A complex live-demo
  77. -------------------
  78. To see a complex example, where ``django-spaghetti-and-meatballs`` really shines,
  79. checkout the live version built for the `Aristotle Metadata Registry <http://registry.aristotlemetadata.com/labs/plate/>`_
  80. Testing and developing
  81. ----------------------
  82. I like keeping my development environments isolated in docker. You can too. If you want to install `poetry` locally, you can skip this bit.
  83. * Build a container with Pythong and Poetry installed - `docker build . -t spaghetti`
  84. * Run a container for developing `docker run -v "$(realpath .)":/site -w /site -p 8000:8000 -it --rm spaghetti bash`
  85. * Install the dependencies - `poetry install`
  86. * Open a poetry shell - `poetry shell`
  87. * Run the server - `django-admin runserver 0.0.0.0:8000`
  88. If you navigate to `127.0.0.1:8000` should should see the demo app.
  89. .. |docs| image:: https://readthedocs.org/projects/django-spaghetti-and-meatballs/badge/?version=latest
  90. :target: https://django-spaghetti-and-meatballs.readthedocs.io/en/latest/
  91. :alt: Documentation Status
  92. .. |code-climate| image:: https://codeclimate.com/github/LegoStormtroopr/django-spaghetti-and-meatballs/badges/gpa.svg
  93. :target: https://codeclimate.com/github/LegoStormtroopr/django-spaghetti-and-meatballs
  94. :alt: Code Climate
  95. .. |coveralls| image:: https://coveralls.io/repos/LegoStormtroopr/django-spaghetti-and-meatballs/badge.svg?branch=master&service=github
  96. :target: https://coveralls.io/github/LegoStormtroopr/django-spaghetti-and-meatballs?branch=master
  97. .. |travis| image:: https://travis-ci.org/LegoStormtroopr/django-spaghetti-and-meatballs.svg?branch=master
  98. :target: https://travis-ci.org/LegoStormtroopr/django-spaghetti-and-meatballs