Created
June 24, 2020 15:08
-
-
Save EXJUSTICE/9d6f8c488e51257542817c43ea9426cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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