IoT - Kubus
/
Kubus
JNP3 16/17
Diff: server/server.py
- Revision:
- 30:27c08888a838
- Parent:
- 16:1569130916f1
- Child:
- 35:0f01042765d6
--- a/server/server.py Tue Jan 10 16:40:04 2017 +0000 +++ b/server/server.py Wed Jan 11 00:11:56 2017 +0100 @@ -1,3 +1,5 @@ +#!/usr/bin/python + from flask import Flask, jsonify from coapserver import CoAPServer from databaseconnector import DatabaseConnector @@ -6,13 +8,13 @@ host = '46.101.12.31' -coapport = 5683 -database = 'kubus.db' +coapport = 4242 +database = '/home/jan/server/kubus.db' tables = ['pir1', 'pir2', 'distance', 'volume'] connector = DatabaseConnector(database=database, tables=tables) -@app.route("/all") +@app.route("/") def all(): d = connector.read() return jsonify(**d) @@ -22,5 +24,5 @@ coapserver = CoAPServer(host, coapport, tables, connector) coapserver.daemon = True coapserver.start() - app.run(host=host) - coapserver.close() \ No newline at end of file + app.run() + coapserver.close()