Skip to content

Commit 2015b41

Browse files
committed
Updated README
1 parent 3386da2 commit 2015b41

File tree

3 files changed

+24
-29
lines changed

3 files changed

+24
-29
lines changed

Diff for: README.rst

+24-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
Django Metrics Dashboard
22
========================
33

4-
DO NOT USE THIS! THIS IS AN EARLY ALPHA AND DOES NOT WORK!
5-
64
A reusable Django app that allows you to display a dashboard with any number
7-
of widgets to show any data you care about. The widets are updated via
5+
of widgets to show any data you care about. The widgets are updated via
86
socket.io, so you never need to refresh your dashboard.
97

8+
You need to setup a socket.io-server that accepts incoming subscriptions and
9+
sends out broadcasts when widgets need an update. For this we have created
10+
https://github.com/bitmazk/django-socketio-messenger
11+
12+
TODO: Write a blog post about how to set this up on Webfaction.
13+
1014
Prerequisites
1115
-------------
1216

1317
You need at least the following packages in your virtualenv:
1418

1519
* Django 1.4.3
1620
* South
21+
* django-libs
22+
* django-load
23+
* requests
24+
* django-socketio
25+
* lockfile
1726

1827
Installation
1928
------------
@@ -65,7 +74,9 @@ DASHBOARD_MESSENGER_URL
6574
Set this to the API endpoint of your ``django-socketio-messenger``
6675
installation. A valid value should look like this::
6776

68-
http://<IP>:<PORT>/broadcast_channel/
77+
http://<HOST>[:<PORT>]/broadcast_channel/
78+
79+
Depending on your setup you might or might not need to specify a port.
6980

7081
We need this because all messages going through socketio must be sent from
7182
the same process. However, this app needs to broadcast messages from an
@@ -87,18 +98,21 @@ For now: Install it and go visit the URL :) More features coming soon.
8798
Creating widgets
8899
----------------
89100

101+
* See https://github.com/bitmazk/md-pypispy-users as an example.
90102
* Create a new Django app. Per convention, you should call your app something
91-
like ``dashboardwidget_yourwidgetname``. This way we can easily search
92-
PyPi for ``dashboardwidget`` and will find all widgets that have been
103+
like ``md_yourwidgetname``. This way we can easily search
104+
PyPi for ``md_`` and will find all widgets that have been
93105
published.
94106
* Give it a file ``dashboard_widget.py``
95107
* Implement your widget. It should inherit ``DashboardWidgetBase``
96108
* Your widget needs the following implementations:
97109
* a ``template_name`` attribute, just like any Django view
110+
* ``sizex`` & ``sizey`` attributes that define the widget size
111+
* an ``update_interval`` attribute in seconds.
98112
* a ``get_context_data`` method. It should return a dictionary
99113
of template context variables
100114
* a ``update_widget_data`` method. It should get data from a 3rd party API
101-
and save it to the widget's model. THen it should send a message to the
115+
and save it to the widget's model. Then it should send a message to the
102116
widget's socket.io channel so that the subscribed browsers know that the
103117
widget has new data and needs an update.
104118
* Register your widget with the ``dashboard_widget_pool``.
@@ -111,6 +125,9 @@ Example ``dashboard_widgets.py``::
111125
class DummyWidget(DashboardWidgetBase):
112126
"""This widget is used by the tests."""
113127
template_name = 'dashboardwidget_dummy/dummy_widget.html'
128+
sizex = 2
129+
sizey = 1
130+
update_interval = 60
114131

115132
def get_context_data(self):
116133
return {
@@ -157,18 +174,6 @@ do the following::
157174
$ ./manage.py schemamigration metrics_dashboard --auto
158175

159176

160-
Compiling the CSS files
161-
-----------------------
162-
163-
If you want to make changes to the CSS files, please edit the files
164-
``metrics-dashboard-variables.less``, ``styles.less`` and
165-
``responsive-styles.less``. Then run ``fab lessc`` from the root of the
166-
project.
167-
168-
If you want to setup a file system watcher and compile the ``.css`` files
169-
automagically, just execute ``./watchmedo-less.sh``.
170-
171-
172177
Discuss
173178
-------
174179

Diff for: fabfile/local.py

-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ def flake8():
99
local('flake8 --statistics metrics_dashboard/.')
1010

1111

12-
def lessc():
13-
"""Compiles all less files."""
14-
local('lessc {0}/static/{0}/css/bootstrap.less'
15-
' {0}/static/{0}/css/bootstrap.css'.format(PROJECT_NAME))
16-
local('lessc {0}/static/{0}/css/responsive.less'
17-
' {0}/static/{0}/css/bootstrap-responsive.css'.format(PROJECT_NAME))
18-
19-
2012
def test():
2113
"""Runs the tests."""
2214
local('./{0}/tests/runtests.py'.format(PROJECT_NAME))

Diff for: watchmedo-less.sh

-2
This file was deleted.

0 commit comments

Comments
 (0)