Added Files

This commit is contained in:
Joachim Hummel
2020-07-22 14:13:09 +02:00
parent 200cc84109
commit ff1789b3e3
12 changed files with 156 additions and 0 deletions

32
web.py Normal file
View File

@@ -0,0 +1,32 @@
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from flask import Flask, flash, redirect, render_template, request, session, abort
from random import randint
def shutdown_server():
func = request.environ.get('werkzeug.server.shutdown')
if func is None:
raise RuntimeError('Not running with the Werkzeug Server')
func()
myapp = Flask(__name__)
@myapp.route('/shutdown', methods=['POST'])
def shutdown():
shutdown_server()
return 'Server shutting down...'
@myapp.route("/")
def hello():
# return name
return render_template(
'test.html', **locals())
if __name__ == "__main__":
myapp.run(host='0.0.0.0', port=80)