Beispiel #1
-1
##-------------------------------------------------------------------
from flask.app import Flask
from flask.templating import render_template
from flask.ext.babel import Babel, gettext as _
from datetime import date
import os


def static(filename):
	"""Provides the 'static' function that also appends the file's timestamp to the URL, usable in a template."""
	timestamp = os.path.getmtime(os.path.join(app.static_folder, filename))
	return "%s/%s?%s" % (app.static_url_path, filename, timestamp)

app = Flask(__name__)
app.config.from_object("settings_dev")
app.static_url_path = app.config["STATIC_URL"]
app.jinja_env.globals.update(static=static)

babel = Babel(app)

greetings = ["Monday Monday, it's not always that gloomy, isn't it?",
				"Happy Tuesday, is everything on track?",
				"It's Wednesday, go go go!",
				"It's Thursday, why not have a good dinner tonight?",
				"Happy Friday, the weekend is coming.",
				"Wow Saturday, how would you like to celebrate it?",
				"It's Sunday, stay tuned for the upcoming great week. Are you ready for it?"]
greeting = _(greetings[date.today().weekday()])


@app.route('/')