mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 00:45:22 +00:00
allow setting custom port
This commit is contained in:
parent
c52340d9cb
commit
7c6a8515c6
9
flask_server.py
Normal file → Executable file
9
flask_server.py
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
from flask import Flask, jsonify, request
|
||||
import numpy as np
|
||||
from modules.class_load import *
|
||||
@ -325,11 +326,15 @@ def get_pdf():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host="0.0.0.0")
|
||||
try:
|
||||
port = os.getenv("FLASK_RUN_PORT", 5000)
|
||||
app.run(debug=True, host="0.0.0.0", port=port)
|
||||
except:
|
||||
print(f"Coud not bind to port {port}, set FLASK_RUN_PORT.")
|
||||
|
||||
|
||||
# PV Forecast:
|
||||
# object {
|
||||
# pvpower: array[48]
|
||||
# temperature: array[48]
|
||||
# }
|
||||
# }
|
||||
|
Loading…
x
Reference in New Issue
Block a user