fixing packaging #1
This commit is contained in:
+7
-6
@@ -2,17 +2,18 @@
|
|||||||
'''Main TeraHz backend program'''
|
'''Main TeraHz backend program'''
|
||||||
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
|
# All code in this file is licensed under the ISC license, provided in LICENSE.txt
|
||||||
from flask import Flask, jsonify
|
from flask import Flask, jsonify
|
||||||
import .terahz
|
from . import terahz
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
|
|
||||||
|
def start_flaskapp():
|
||||||
|
global app, s, u, l
|
||||||
|
app = Flask(__name__)
|
||||||
|
s = terahz.Spectrometer(path='/dev/serial0')
|
||||||
|
u = terahz.UVSensor()
|
||||||
|
l = terahz.LxMeter()
|
||||||
|
|
||||||
@app.route('/data')
|
@app.route('/data')
|
||||||
def sendData():
|
def sendData():
|
||||||
'''Responder function for /data route'''
|
'''Responder function for /data route'''
|
||||||
s = sensors.Spectrometer(path='/dev/serial0')
|
|
||||||
u = sensors.UVSensor()
|
|
||||||
l = sensors.LxMeter()
|
|
||||||
response = jsonify([s.getData(), l.getData(), u.getABI()])
|
response = jsonify([s.getData(), l.getData(), u.getABI()])
|
||||||
response.headers.add('Access-Control-Allow-Origin', '*')
|
response.headers.add('Access-Control-Allow-Origin', '*')
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user