Bachelorthesis_Code/backend/src/app.py

35 lines
575 B
Python
Raw Normal View History

import time
from flask import Flask
2021-06-21 22:58:08 +00:00
import os
app = Flask(__name__)
2021-06-21 22:58:08 +00:00
# Read environment variables
if "DEBUG" in os.environ and os.environ["DEBUG"] == 'yes':
debug = True
else:
debug = False
if "HOST" in os.environ:
host = os.environ["HOST"]
else:
host = '0.0.0.0'
if "PORT" in os.environ:
port = int(os.environ["PORT"])
else:
port = 5000
@app.route('/')
def home():
return "Hello World"
@app.route('/time')
def get_current_time():
return {'time': time.time()}
2021-06-21 22:58:08 +00:00
if __name__ == '__main__':
app.run(debug=debug, host=host, port=port)