from flask import ( Flask, render_template, request, render_template_string ) app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def index(): output = "" blacklist = ["config", "self", "_", '"', "request", "[", "]", "join", "%", "%25", "app"] if request.method == 'POST': search_term = request.form.get('search_term', '') output = 'Backup "' + search_term + '" is not available due to technical issues.' for x in blacklist: if x in search_term: output = 'Are you doing something naughty on this backup server?' break return render_template('index.html', search_result=render_template_string(output)) @app.route('/about') def about(): return render_template('about.html') @app.route('/contact') def contact(): return render_template('contact.html')