Created
April 14, 2019 09:38
-
-
Save jensjeflensje/7224489acdd3d4428624a1ddd72bc7e9 to your computer and use it in GitHub Desktop.
Flask tutorial 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| h1 { | |
| color: red; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="nl"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Youtube Flask Tutorial</title> | |
| <link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}"> | |
| </head> | |
| <body> | |
| <h1>{{ hallo_text }}</h1> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, render_template, send_from_directory | |
| import os | |
| app = Flask(__name__) | |
| @app.route("/") | |
| def index(): | |
| return render_template("index.html", hallo_text="Hallo") | |
| @app.route('/favicon.ico') | |
| def favicon(): | |
| return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico', mimetype='image/vnd.microsoft.icon') | |
| app.run(port=80) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment