Created
February 16, 2015 04:40
-
-
Save rtuita23/46499940913ba9116d09 to your computer and use it in GitHub Desktop.
Run
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
from flask import Flask, render_template | |
from datetime import datetime | |
app = Flask(__name__) | |
@app.route('/') | |
def template_test(): | |
return render_template('template.html', my_string='Wheeeee!', my_list=[0,1,2,3,4,5]) | |
@app.route("/home") | |
def home(): | |
return render_template('template.html', | |
my_string="I'm the home page", | |
my_list=[0,1,2,3,4,5], | |
) | |
''' | |
@app.route("/about") | |
def about(): | |
return render_template('template.html', | |
my_string="I'm the about page", | |
my_list=[0,1,2,3,4,5], | |
) | |
@app.route("/contact") | |
def contact(): | |
return render_template('template.html', | |
my_string="I'm the contact page", | |
my_list=[0,1,2,3,4,5], | |
current_time=datetime.datetime.now() | |
) | |
@app.template_filter("fomatdate") | |
def datetimefilter(value, format='%Y/%m/%d %H:%M'): | |
"""Convert a datetime to a different format.""" | |
return value.strftime(format) | |
''' | |
if __name__ == '__main__': | |
app.run(debug=True, host='0.0.0.0', port=8080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment