{ "info": { "author": "tax", "author_email": "paultax@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "#Drax dashboard\n\nDrax is a python and react implementation of the beautiful [dashing](http://shopify.github.io/dashing/) app that has minimal dependencies. I created this project to develop my [react](http://facebook.github.io/react/index.html) and [tornado](http://www.tornadoweb.org/) skills.\n\n## How to use drax\nAfter you installed drax run the following commands:\n\n```\n $ drax init mydashboard\n $ cd mydashboard\n $ drax start\n```\n\nNow a new dashboard is available on http://localhost:8888/\n\n\nEvery project comes with some base widgets and an example dashboard. The directory is setup as follows:\n\n* **Assets** - All your images, fonts, and javascript libraries.\n* **Dashboards** - One html file for each dashboard that contains the layout for the widgets. The default dashboard is defined in *index.html*.\n* **Jobs** - The python jobs for fetching data to sent to your widgets.\n* **Widgets** - All the jsx and css files for individual widgets.\n\n\n## How to create a dashboard\nBy editing the *index.html* file in the *templates* directory: \n\n```javascript\n React.render(\n \n \n \n \n \n \n \n \n ,\n document.getElementById('dashboard'));\n```\n\nIf you want to add more dashboards copy *index.html* to a new html file in the templates directory and edit that file.\n\nIf you created a new dashboard *status.html* it will be available on http://localhost:8888/status **(Notice the url without the \".html\")**.\n\n\n## How get data into widgets\nYour widgets can be updated directly over HTTP. Post the data you want in json to /widgets/widget_id. \nExample\n\n```\ncurl -d '{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Some new text...\"}' http://localhost:8888/widgets/text\n```\nor a python example:\n\n```python\nimport json\nimport requests\n\nurl = 'http://localhost:8888/widgets/text'\ndata = {\n 'auth_token': 'YOUR_AUTH_TOKEN',\n 'text': 'Some new text...',\n 'id': 'text'\n}\n\nrequests.post(url, data=json.dumps(data))\n\n```\n\n## How to create a job\nEvery file with the .py extension in the jobs folder is loaded as a job and executed periodically. \n\nEach job needs to define a function named *callback* (the actual job) and a variable *callback_time* that defines the time in milliseconds of the frequency the job is executed.\n\nAn example of a job executing every 30 seconds:\n```python\nimport json\nfrom tornado.httpclient import AsyncHTTPClient\n\n# callback function is called every 30 seconds\ncallback_time = 30000\n\n\ndef get_myapi_data():\n # Add logic to fetch data from somewhere\n data = 'This is some data loaded from somewhere...'\n return data\n\n\ndef callback():\n data = {\n 'auth_token': 'YOUR_AUTH_TOKEN',\n # the id of the widget you want to post the data to\n 'id': 'text',\n 'title': 'Some Info:',\n 'icon': 'icon-star',\n 'text': get_myapi_data()\n }\n payload = json.dumps(data)\n url = 'http://localhost:8888/widgets/text'\n\n # Using tornado async client\n client = AsyncHTTPClient()\n client.fetch(url, None, method='POST', headers=None, body=payload)\n```\n\n## How to reload your dashboards\n\nYou can also perform dashboard-level actions by posting to /dashboards/dashboard_id. Currently there is a single event available, reload, that will refresh the target dashboard in the browser.\n\n```\ncurl -i -d '{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"event\": \"reload\"}' http://localhost:8888/dashboards/index\n```\n\nIf you want an event to target every dashboard, you can use a wildcard (*).\n\n```\ncurl -i -d '{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"event\": \"reload\"}' http://localhost:8888/dashboards/*\n```\n\n## Installation\nInstalling drax is easy with pip:\n\n```\n $ pip install drax\n```\n\n## Developing\nTo run tests:\n```\n $ python test.py\n```\nTested with python 2.7\n\n[![Build Status](https://travis-ci.org/tax/drax.svg?branch=master)](https://travis-ci.org/tax/drax)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/tax/drax", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "drax", "package_url": "https://pypi.org/project/drax/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/drax/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/tax/drax" }, "release_url": "https://pypi.org/project/drax/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "Drax is a react and python implementation of the dashingdashboard", "version": "0.4.0" }, "last_serial": 1296643, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "bebb05b692ddb12afc2a42360e13ecde", "sha256": "ac42727a03e7d56e34cd5d63f14bc533a5dcbb7b53c9cad423a4e5901ba3a921" }, "downloads": -1, "filename": "drax-0.2.0.tar.gz", "has_sig": false, "md5_digest": "bebb05b692ddb12afc2a42360e13ecde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 415389, "upload_time": "2014-11-02T19:48:27", "url": "https://files.pythonhosted.org/packages/8f/4e/62118f853517e06031f91288a9d46de565b04034b4f655dfeed8eb217c35/drax-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "8e57257b88d2965147660c1c740411cf", "sha256": "3df5cc001e3c6f4fe4237d11ce1f6f989b8f02c7df11960637eae1c07d4ffecb" }, "downloads": -1, "filename": "drax-0.3.0.tar.gz", "has_sig": false, "md5_digest": "8e57257b88d2965147660c1c740411cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 415793, "upload_time": "2014-11-02T19:52:22", "url": "https://files.pythonhosted.org/packages/52/f4/4c98b5c1b0a2f080b25bbf15d60b7686dddcd0285212a84f7959f3e6450b/drax-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "9f900d797695b9ef141e9747b0475e86", "sha256": "9100cf004d021d7a9e0c5ca939cc30b50015cf0353f9703851ccd47356ff0c56" }, "downloads": -1, "filename": "drax-0.4.0.tar.gz", "has_sig": false, "md5_digest": "9f900d797695b9ef141e9747b0475e86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 416470, "upload_time": "2014-11-06T11:32:56", "url": "https://files.pythonhosted.org/packages/1e/e5/0ce0fbde3e0d3ce67068f7e16e57a9a29dc65c7c9abe9b1dbd7726f4b9ed/drax-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9f900d797695b9ef141e9747b0475e86", "sha256": "9100cf004d021d7a9e0c5ca939cc30b50015cf0353f9703851ccd47356ff0c56" }, "downloads": -1, "filename": "drax-0.4.0.tar.gz", "has_sig": false, "md5_digest": "9f900d797695b9ef141e9747b0475e86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 416470, "upload_time": "2014-11-06T11:32:56", "url": "https://files.pythonhosted.org/packages/1e/e5/0ce0fbde3e0d3ce67068f7e16e57a9a29dc65c7c9abe9b1dbd7726f4b9ed/drax-0.4.0.tar.gz" } ] }