Hybrid Publishing hybrid publication of the project Volitional Volutions of the Volatile Waters
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from flask import Flask
|
|
|
|
from flask import render_template, jsonify
|
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
@app.context_processor
|
|
|
|
def override_url_for():
|
|
|
|
return dict(url_for=dated_url_for)
|
|
|
|
|
|
|
|
def dated_url_for(endpoint, **values):
|
|
|
|
if endpoint == 'static':
|
|
|
|
filename = values.get('filename', None)
|
|
|
|
if filename:
|
|
|
|
file_path = os.path.join(app.root_path,
|
|
|
|
endpoint, filename)
|
|
|
|
values['q'] = int(os.stat(file_path).st_mtime)
|
|
|
|
return url_for(endpoint, **values)
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
def hello_world():
|
|
|
|
return render_template('hello.html')
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/hello/<name>')
|
|
|
|
|
|
|
|
@app.route("/get-data")
|
|
|
|
def get_data():
|
|
|
|
return jsonify({"a": 1, "b": 2})
|
|
|
|
|