{ "info": { "author": "Martin Brochhaus", "author_email": "mbrochh@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Django Dashboard App\n====================\n\nA reusable Django app for displaying a dashboard with a fluid grid of widgets.\n\nLet's say you control 20 different web apps and you want to have a dashboard\nthat shows the user count of each app as a graph. The graphs should be updated\nevery minute so that you can see immediately when a sudden spike of new user\nsignups happens.\n\nThere are two ways:\n\n1. Your apps provide an API endpoint for your dashboard so that the dashboard\n can poll that endpoint every minute and get the current user count.\n2. Your dashboard provides an endpoint that can be called by your apps whenever\n a new user signs up.\n\nUltimately, both methods should be possible with this app. Currently only the\nfirst way is implemented.\n\nThe dashboard itself will consist of many plugins. Each plugin is a reusable\nDjango app of it's own. This allows you to write any kind of plugin for any\nkind of service.\n\nNote: A while ago I already created\nhttps://github.com/bitmazk/django-metrics-dashboard to solve this exact problem\nbut I wanted to have socket.io support, which was a bad idea. It didn't really\nwork out nicely and kept crashing so that I abandoned the project in the end.\nThis is my second try, this time I'm using old-school polling once per minute\nvia AJAX.\n\n\nInstallation\n============\n\nTo get the latest stable release from PyPi\n\n.. code-block:: bash\n\n pip install django-dashboard-app\n\nTo get the latest commit from GitHub\n\n.. code-block:: bash\n\n pip install -e git+git://github.com/bitmazk/django-dashboard-app.git#egg=dashboard_app\n\nTODO: Describe further installation steps (edit / remove the examples below):\n\nAdd ``dashboard_app`` and ``django.contrib.humanize`` to your\n``INSTALLED_APPS``:\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...,\n 'django.contrib.humanize',\n 'dashboard_app',\n )\n\nAdd the ``dashboard_app`` URLs to your ``urls.py``\n\n.. code-block:: python\n\n urlpatterns = patterns('',\n ...\n url(r'^dashboard/', include('dashboard_app.urls')),\n )\n\nDon't forget to migrate your database\n\n.. code-block:: bash\n\n ./manage.py migrate dashboard_app\n\n\nUsage\n-----\n\nWhen you first visit the main URL for your dashboard, you will see an error\nwidget saying \"No widgets found\". This means we need to teach Django which\nwidgets to display.\n\nIn your Django project-app-folder (assuming Django >1.5 project layout) create\na ``dashboard_widgets.py`` file (you can put that file into any app folder that\nis part of ``INSTALLED_APPS``).\n\nAdd the following code to that file:\n\n.. code-block:: python\n\n \"\"\"Widgets for the ACME project.\"\"\"\n from dashboard_app.dashboard_widgets import DummyWidget\n from dashboard_app.widget_pool import dashboard_widget_pool\n\n\n dashboard_widget_pool.register_widget(DummyWidget, position=1)\n\nWhen you call your main dashboard URL now, you should see the dummy widget\ndisplaying the current date and time. The last update time resembles the time\nwhen the widget did write data to the database last time. Since this widget\nnever writes any data, this time will always be the time when you first loaded\nthe widget under this name.\n\nBuild Your Widget\n-----------------\n\nFirst you need to decide where your widget code should live. If you are very\nsure that your widgets will always be bound to the project and never be\nreleased as open source or re-used in other projects of yours, you can\nimplement your widgets in the ``dashboard_widgets.py`` file that you have\ncreated in your Django project-app already.\n\nIf you think that your widget will be usefull for many projects, you should\ncreate it as a reusable app and therefore create a new app-folder. Let's\nassume that your project is called ``ACME`` and you want to create a widget\nto display the current user count. First create the following files:\n\n.. code-block:: text\n\n -- dashboard_acme_users\n ---- __init__.py\n ---- models.py\n ---- dashboard_widgets.py\n\nYour widget apps should always be named like ``dashboard_yourthing`` so that\nit is easier to find them all on Google/Github. The ``__init__.py`` file will\nturn the app into a Python module and the ``models.py`` file is needed to turn\nthe module into a potential Django app that can be discovered by the\n``INSTALLED_APPS`` setting. The ``dashboard_widgets.py`` file is the file\nwhere you will implement your custom widget.\n\nPut the following code into that file:\n\n.. code-block:: python\n\n \"\"\"Widgets for the dashboard_acme_users app.\"\"\"\n from dashboard_app.widget_base import DashboardWidgetBase\n\n from django.contrib.auth.models import User\n\n\n class UserCountWidget(DashboardWidgetBase):\n \"\"\"Displays the total amount of users currently in the database.\"\"\"\n template_name = 'dashboard_acme_users/widgets/user_count.html'\n\n def get_context_data(self):\n ctx = super(UserCountWidget, self).get_context_data()\n count = User.objects.all().count()\n ctx.update({'value': count, })\n return ctx\n\nYou basically just have to decide on a nice widget name (here:\n``UserCountWidget``) and a template name. We suggest to put the widgets into\na subfolder called ``your_app_name/widgets`` and name the template after the\nwidget's class name (here: ``user_count.html``).\n\nNow you want to display something. In our case it is the current user count.\nTherefore we must override the ``get_context_data`` method and return the\ncurrent user count.\n\nNow you need to register your new widget in the ``dashboard_widgets.py`` file\nthat you used earlier to register the DummyWidget:\n\n.. code-block:: python\n\n \"\"\"Widgets for the ACME project.\"\"\"\n from dashboard_app.dashboard_widgets import DummyWidget\n from dashboard_app.widget_pool import dashboard_widget_pool\n\n from dashboard_acme_users import dashboard_widgets as widgets\n\n\n dashboard_widget_pool.register_widget(DummyWidget, position=1)\n dashboard_widget_pool.register_widget(widgets.UserCountWidget, position=2)\n\nWhen you visit your main dashboard URL you should see two widgets now.\n\nTODO: Describe how to save widget data to the database and render charts\n\nContribute\n----------\n\nIf you want to contribute to this project, please perform the following steps\n\n.. code-block:: bash\n\n # Fork this repository\n # Clone your fork\n mkvirtualenv -p python2.7 django-dashboard-app\n make develop\n\n git co -b feature_branch master\n # Implement your feature and tests\n git add . && git commit\n git push -u origin feature_branch\n # Send us a pull request for your feature branch", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bitmazk/django-dashboard-app", "keywords": "django,app,reusable,dashboard,grid,widgets", "license": "The MIT License", "maintainer": null, "maintainer_email": null, "name": "django-dashboard-app", "package_url": "https://pypi.org/project/django-dashboard-app/", "platform": "OS Independent", "project_url": "https://pypi.org/project/django-dashboard-app/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/bitmazk/django-dashboard-app" }, "release_url": "https://pypi.org/project/django-dashboard-app/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "A reusable Django app for displaying a dashboard with a fluid grid of widgets.", "version": "0.2.1" }, "last_serial": 1055554, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "592210fad9da505aa95b25282c13f42f", "sha256": "179501e902d6cb02fa45a955e2573d86329aadcd7d0d7c51ed7aab609fb5d7b5" }, "downloads": -1, "filename": "django-dashboard-app-0.1.tar.gz", "has_sig": false, "md5_digest": "592210fad9da505aa95b25282c13f42f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 133771, "upload_time": "2014-04-08T12:20:08", "url": "https://files.pythonhosted.org/packages/3d/20/0b05ad6bd1e82208e6b883cdf3e078044b6c05ac24a36c57cf4048a4c8b1/django-dashboard-app-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "cedaba14a9b4e6aba5e32d752d95e6e2", "sha256": "d7517826c3cfdd3010707986320ff5571da08ee2cf1378457107c36862c53955" }, "downloads": -1, "filename": "django-dashboard-app-0.2.tar.gz", "has_sig": false, "md5_digest": "cedaba14a9b4e6aba5e32d752d95e6e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 134385, "upload_time": "2014-04-09T03:09:13", "url": "https://files.pythonhosted.org/packages/68/41/93804f20774ca2b556ff2b707348d247bbed2532e797ace1ed3028be2fe6/django-dashboard-app-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "7eb3617c8b88a8c7ef14acea2f127790", "sha256": "6edf47262c14a69fcf6d5d48b7ebd6a96dba639d716cf3a52f1954e8af5bff38" }, "downloads": -1, "filename": "django-dashboard-app-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7eb3617c8b88a8c7ef14acea2f127790", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 134460, "upload_time": "2014-04-09T04:00:05", "url": "https://files.pythonhosted.org/packages/8a/01/f1f6f2adf3889261c6f089712119690d6bb5ad4f44488eb5d7f79a55aa2d/django-dashboard-app-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7eb3617c8b88a8c7ef14acea2f127790", "sha256": "6edf47262c14a69fcf6d5d48b7ebd6a96dba639d716cf3a52f1954e8af5bff38" }, "downloads": -1, "filename": "django-dashboard-app-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7eb3617c8b88a8c7ef14acea2f127790", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 134460, "upload_time": "2014-04-09T04:00:05", "url": "https://files.pythonhosted.org/packages/8a/01/f1f6f2adf3889261c6f089712119690d6bb5ad4f44488eb5d7f79a55aa2d/django-dashboard-app-0.2.1.tar.gz" } ] }