Skip to content

Instantly share code, notes, and snippets.

@EXJUSTICE
Created June 24, 2020 15:08
Show Gist options
  • Save EXJUSTICE/9d6f8c488e51257542817c43ea9426cd to your computer and use it in GitHub Desktop.
Save EXJUSTICE/9d6f8c488e51257542817c43ea9426cd to your computer and use it in GitHub Desktop.
from flask import Flask, redirect, render_template, request, url_for
app = Flask(__name__)
app.config["DEBUG"] = True
comments = []
#Follow https://pythonprogramming.net/jquery-flask-tutorial/
@app.route("/", methods=["GET"])
def index():
return render_template("main_page.html", comments=comments)
@app.route("/background_process",methods=["GET","POST"])
def background_process():
try:
lang = request.args.get('proglang')
if str(lang).lower()=='python':
return jsonify(result='Nice')
else:
return jsonify(result='Crap')
except Exception as e:
return (str(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment