Flask
Revision as of 18:15, 9 June 2018 by Alexander Roidl (talk | contribs) (Created page with "=Flask= Short introduction guide on Flask. http://flask.pocoo.org/ (Used for XPPL, so to see a more advanced use in connection with database, see XPPL) ==Basic Flask==...")
Flask
Short introduction guide on Flask. http://flask.pocoo.org/ (Used for XPPL, so to see a more advanced use in connection with database, see XPPL)
Basic Flask
Flask is a microframework for python to create web applications. It basically connects the webserver with your python code.
Install
$ pip install Flask
Simple text serving
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!"
- with @app.route you can define the url flask respons to.
- the function definition after is mandetory as well as the return.
- everything that comes after return gets sent back to the browser (http GET request)
Run it with:
$ FLASK_APP=hello.py flask run