add app_dash.py and some files

This commit is contained in:
Mathieu Moran
2023-11-18 00:23:00 -05:00
parent 37f7d99883
commit 7a90b3768a
12 changed files with 116 additions and 50 deletions
+16 -8
View File
@@ -1,18 +1,15 @@
from flask import Flask, render_template, make_response, json
import app_obd, app_car, app_account, time
import app_obd, app_car, app_account, time, app_events
from app_events import socketio
app = Flask(__name__)
socketio.init_app(app)
account = app_account.Account()
obd = app_obd.OBD()
car = app_car.Car()
app_obd.obd_connection()
@app.route('/')
def index():
print("hello "+account.name)
return render_template('index.html', account = account)
print("hello")
return render_template('index.html')
@app.route('/dtc')
def dtc():
@@ -24,4 +21,15 @@ def data():
data = app_obd.speed
response = make_response(json.dumps(data))
response.content_type = 'application/json'
return response
return response
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Run the Flask application with a custom port."
)
parser.add_argument(
"--port", type=int, default=5000, help="Port number (default is 5000)"
)
args = parser.parse_args()
app.run(debug=True, port=args.port)