Skip to content
Snippets Groups Projects
Commit 1b93af34 authored by TheJoeCoder's avatar TheJoeCoder
Browse files

Major restructure... again

parent bbbbd410
Branches
No related tags found
No related merge requests found
# PizzaPalace
GCSE Computer Science Challenge
## Installation
## Running the Server
```
git clone https://github.com/TheJoeCoder/PizzaPalace
cd PizzaPalace
pip install -r requirements.txt
echo "SECRET_KEY = 'SOME_KEY'" > app/config.py
python -m flask --app=pizza run
cd server
cp config.py.example config.py
python app.py
```
\ No newline at end of file
api_url="https://api.example.com/"
\ No newline at end of file
import tkinter
import json
from tkinter import ttk, messagebox
## Init
root = Tk()
## Global Variables
name = StringVar()
age = StringVar()
## Subroutines
def submit(*args):
messagebox.showinfo("Not implemented")
## Main program code
root.title("Pizza Palace")
mainframe = ttk.Frame(root, padding="3 3 12 12")
mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
name_label = ttk.Label(mainframe, text="Pizza Type: ")
name_label.grid(column=1, row=1, sticky=(W, E))
name_entry = ttk.Entry(mainframe, width=10, textvariable=name)
name_entry.grid(column=2, row=1, sticky=(W, E))
age_label = ttk.Label(mainframe, text="Age: ")
age_label.grid(column=1, row=2, sticky=(W, E))
age_entry = ttk.Entry(mainframe, width=10, textvariable=age)
age_entry.grid(column=2, row=2, sticky=(W, E))
submit_button = ttk.Button(mainframe, text="Go!", command=submit)
submit_button.grid(column=2, row=3, sticky=(W, E))
for child in mainframe.winfo_children():
child.grid_configure(padx=5, pady=5)
name_entry.focus()
root.bind("<Return>", submit)
root.mainloop()
from flask import Flask, render_template, url_for
import json
from flask import Flask, request, jsonify, Response
app = Flask(__name__)
import config
with open("pizza_types.json","r") as f:
pizza_types = json.loads(f.read())
open_carts = {}
@app.route("/")
def hello_world():
return render_template("index.html")
return "{\"status\":200, \"message\": \"ok\"}", 200
@app.route("/pizzas", methods=["GET"])
def get_pizzas():
return jsonify(pizza_types), 200
@app.route("/cart/open", methods=["POST"])
def open_cart():
return "{\"status\":404, \"message\": \"not implemented\"}", 404
if __name__ == "__main__":
app.run()
\ No newline at end of file
webhook = "https://example.com/webhook"
\ No newline at end of file
[
{
"id": "margherita",
"name": "Margherita",
"cost_pp": 3,
"stuffed_pp": 1
},
{
"id": "pepperoni",
"name": "Pepperoni",
"cost_pp": 3,
"stuffed_pp": 1
},
{
"id": "hawaiian",
"name": "Hawaiian",
"cost_pp": 4,
"stuffed_pp": 1
},
{
"id": "buffalo_chicken",
"name": "Buffalo Chicken",
"cost_pp": 5,
"stuffed_pp": 1
},
{
"id": "veg_feast",
"name": "Vegetable Feast",
"cost_pp": 4,
"stuffed_pp": 1
}
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment