Last active
December 17, 2015 02:18
-
-
Save Depado/5534226 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python2.7 | |
# -*- coding: utf-8 -*- | |
from flask import Flask, render_template | |
# Pour définir que tout le truc est une appli Flask | |
app = Flask(__name__) | |
# On définit le chemin route du genre ratemyfirefart.com/ ou ratemyfirefart.com/index | |
@app.route('/index') | |
@app.route('/') | |
# A chaque route ou a chaque ensemble de route on associe une fonction | |
def index(): | |
# Chaque fonction qui définit une route doit se terminer par un return HTML | |
# Dans ce cas là on utilise render_template pour faire apparaitre à l'écran index.html | |
return render_template("index.html") | |
# Sans les commentaires ça donnerai ça : | |
@app.route('/fart') | |
def fart(): | |
return render_template("fart.html") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment