2018-06-10 17:58:27 +00:00
|
|
|
|
# Devicehub
|
|
|
|
|
|
|
|
|
|
Devicehub is an IT Asset Management System focused in reusing devices,
|
|
|
|
|
created under the project [eReuse.org](https://www.ereuse.org).
|
|
|
|
|
|
|
|
|
|
Our main objectives are:
|
|
|
|
|
|
|
|
|
|
- To offer a common IT Asset Management for donors, receivers and IT
|
|
|
|
|
professionals so they can manage devices and exchange them.
|
|
|
|
|
This is, reusing –and ultimately recycling.
|
|
|
|
|
- To automatically recollect, analyse, process and share
|
|
|
|
|
(controlling privacy) metadata about devices with other tools of the
|
|
|
|
|
eReuse ecosystem to guarantee traceability, and to provide inputs for
|
|
|
|
|
the indicators which measure circularity.
|
|
|
|
|
- To highly integrate with existing IT Asset Management Systems.
|
|
|
|
|
- To be decentralized.
|
|
|
|
|
|
|
|
|
|
Devicehub is built with [Teal](https://github.com/bustawin/teal) and
|
|
|
|
|
[Flask](http://flask.pocoo.org).
|
|
|
|
|
|
2018-06-20 21:32:42 +00:00
|
|
|
|
## Installing
|
2018-06-10 17:58:27 +00:00
|
|
|
|
The requirements are:
|
|
|
|
|
|
2018-06-21 14:49:33 +00:00
|
|
|
|
- Python 3.5.3 or higher.
|
2018-06-21 15:10:17 +00:00
|
|
|
|
- Python Pip 3
|
2018-06-10 17:58:27 +00:00
|
|
|
|
- PostgreSQL 9.6 or higher.
|
|
|
|
|
|
2018-06-21 15:22:04 +00:00
|
|
|
|
```bash
|
|
|
|
|
$ apt-get install python3-pip postgresql postgresql-client python3.5
|
|
|
|
|
```
|
|
|
|
|
|
2018-06-20 16:24:10 +00:00
|
|
|
|
Install Devicehub with *pip*: `pip3 install ereuse-devicehub -U --pre`.
|
2018-06-10 17:58:27 +00:00
|
|
|
|
|
2018-06-21 15:29:05 +00:00
|
|
|
|
`flask` is needed for running the server.
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
$ pip3 install flask
|
|
|
|
|
```
|
|
|
|
|
|
2018-06-10 17:58:27 +00:00
|
|
|
|
## Running
|
2018-06-20 21:32:42 +00:00
|
|
|
|
Create a python file with the following and call it `app.py`:
|
2018-06-10 17:58:27 +00:00
|
|
|
|
```python
|
|
|
|
|
from ereuse_devicehub.devicehub import Devicehub
|
|
|
|
|
from ereuse_devicehub.config import DevicehubConfig
|
|
|
|
|
class MyConfig(DevicehubConfig):
|
|
|
|
|
ORGANIZATION_NAME = 'My org'
|
|
|
|
|
ORGANIZATION_TAX_ID = 'foo-bar'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app = Devicehub(MyConfig())
|
|
|
|
|
```
|
2018-06-20 21:32:42 +00:00
|
|
|
|
Create a PostgreSQL database called *dh-db1*:
|
|
|
|
|
|
2018-06-21 15:26:36 +00:00
|
|
|
|
```bash
|
|
|
|
|
$ sudo -u postgres psql postgres
|
|
|
|
|
postgres=# createdb dh-db1
|
|
|
|
|
postgres=# \q
|
|
|
|
|
```
|
2018-06-20 21:32:42 +00:00
|
|
|
|
|
|
|
|
|
Create the tables in the database by executing in the same directory
|
|
|
|
|
where `app.py` is:
|
2018-06-10 17:58:27 +00:00
|
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
|
```bash
|
|
|
|
|
$ flask init-db
|
|
|
|
|
```
|
2018-06-20 16:24:10 +00:00
|
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
|
Finally, run the app:
|
2018-06-20 21:32:42 +00:00
|
|
|
|
|
2018-06-10 17:58:27 +00:00
|
|
|
|
```bash
|
|
|
|
|
$ flask run
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
See the [Flask quickstart](http://flask.pocoo.org/docs/1.0/quickstart/)
|
2018-06-20 16:24:10 +00:00
|
|
|
|
for more info.
|
2018-06-20 21:18:15 +00:00
|
|
|
|
|
2018-06-20 21:32:42 +00:00
|
|
|
|
## Administrating
|
2018-06-20 21:18:15 +00:00
|
|
|
|
Devicehub has many commands that allows you to administrate it. You
|
|
|
|
|
can, for example, create a dummy database of devices with ``flask dummy``
|
|
|
|
|
or create users with ``flask create-user``. See all the
|
2018-06-21 14:49:33 +00:00
|
|
|
|
available commands by just executing ``flask``.
|