Python http://kohnlehome.de/python/webserver.pdf
Python-Webserver
Installation
pip install flask
Festen Code ausliefern
from flask import Flask app = Flask("my hello app")
@app.route("/hello") def hello():
return "Hello World!"
app.run()
Statische Dateien ausliefern (aus Verzeichnis ’static’)
from flask import Flask
app = Flask(__name__, static_folder=’static’, static_url_path=’’)
@app.route("/") def root():
return app.send_static_file(’index.html’) app.run()
Franz Kohnle Seite 1 von 1 20. Dezember 2020