app.py 702 B

12345678910111213141516171819202122232425
  1. from flask import Flask,render_template,request
  2. import pandas as pd
  3. import csv
  4. app = Flask(__name__)
  5. @app.route("/",methods=['GET','POST'])
  6. def index():
  7. return render_template("index.html",title='ERP WEB')
  8. @app.route("/data",methods=['GET','POST'])
  9. def data():
  10. if request.method =='POST':
  11. f = request.form['csvfile']
  12. data = []
  13. with open(f,encoding='UTF8') as file:
  14. csvfile = csv.reader(file)
  15. for row in csvfile:
  16. data.append(row)
  17. data = pd.DataFrame(data)
  18. return render_template('data.html',data=data.to_html(header=False,index=False))
  19. if __name__ == '__main__':
  20. app.run(debug=True)