-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
23 lines (19 loc) · 717 Bytes
/
main.py
File metadata and controls
23 lines (19 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask, render_template, request, send_file
import pandas as pd
from gamefy import game_maker #Locally created code to create the games
import os
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/upload', methods=["POST", "GET"])
def upload():
if request.method == "POST":
file = request.files['file']
df = pd.read_excel(file)
df = game_maker(df) #Call the function
return send_file(df, as_attachment=True, attachment_filename="mydownload.xlsx")
else:
return render_template('upload.html')
if __name__ == "__main__":
app.run(host="127.0.0.1", port=8080, debug=True)