Select Git revision
app.py 994 B
import os
from flask import Flask, request, render_template
from markupsafe import escape
from jinja2 import Environment
app = Flask(__name__)
Jinja2 = Environment()
@app.route("/")
def index():
return render_template('index.html')
@app.route("/email-settings/opt-out")
def email_opt_out():
email = request.values.get("email")
output = Jinja2.from_string('You have opted out ' + email +
' from our service.' +
'<p>Go back to <a href="/">home</a>.</p>').render()
return output
@app.route("/source-code")
def source_code():
current_file_path = os.path.abspath(__file__)
with open(current_file_path, "r", encoding="utf-8") as file:
app_code = file.read()
escaped_code = escape(app_code)
return render_template('source_code.html', escaped_code=escaped_code, app_name=os.path.basename(current_file_path))
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)