Skip to content

Instantly share code, notes, and snippets.

@rtuita23
Created February 16, 2015 04:40
Show Gist options
  • Save rtuita23/46499940913ba9116d09 to your computer and use it in GitHub Desktop.
Save rtuita23/46499940913ba9116d09 to your computer and use it in GitHub Desktop.
Run
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