-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
30 lines (22 loc) 路 790 Bytes
/
Copy pathapp.py
File metadata and controls
30 lines (22 loc) 路 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from flask import Flask, render_template, request
from compiler_engine.run_compiler import run_chef_compiler
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
@app.route("/about")
def about():
return render_template("about.html")
@app.route("/compile", methods=["POST"])
def compile_code():
chef_code = request.form.get("chef_code")
# Run the compiler and get actual output
output = run_chef_compiler(chef_code)
# Show the result in result.html
return render_template("result.html", c_output=output)
@app.errorhandler(404)
def page_not_found(e):
return render_template("404.html"), 404
if __name__ == "__main__":
print("馃嵆 The Chef's Code Kitchen is open at http://127.0.0.1:5000/")
app.run(debug=True)