Skip to content

Instantly share code, notes, and snippets.

@jensjeflensje
Created April 14, 2019 09:38
Show Gist options
  • Select an option

  • Save jensjeflensje/7224489acdd3d4428624a1ddd72bc7e9 to your computer and use it in GitHub Desktop.

Select an option

Save jensjeflensje/7224489acdd3d4428624a1ddd72bc7e9 to your computer and use it in GitHub Desktop.
Flask tutorial 2
h1 {
color: red;
}
<!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>
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