# -*- coding: utf-8 -*- from flask import Flask, render_template, send_file, request import os from fonctions import classejoueur, tour app = Flask(__name__) IMG_FOLDER = os.path.join('static', 'IMG') app.config['UPLOAD_FOLDER'] = IMG_FOLDER @app.route('/') def index(): petit_logo = os.path.join(app.config['UPLOAD_FOLDER'], 'petit_logo.png') celestial = os.path.join(app.config['UPLOAD_FOLDER'], 'celestial.png') titre = os.path.join(app.config['UPLOAD_FOLDER'], 'titre.png') fleche = os.path.join(app.config['UPLOAD_FOLDER'], 'fleche.png') passage = os.path.join(app.config['UPLOAD_FOLDER'], 'passage.png') return render_template('index.html', petit_logo=petit_logo, celestial=celestial, titre=titre, fleche=fleche, passage=passage) @app.route('/download') def download(): jeu = 'static/download_files/cube runner_red alert.rar' return send_file(jeu, as_attachment=True) @app.route('/resultat',methods = ['POST']) def resultat(): result = request.form f = int(result['frags']) d = int(result['death']) c=classejoueur(f, d) t=tour(c) petit_logo = os.path.join(app.config['UPLOAD_FOLDER'], 'petit_logo.png') celestial = os.path.join(app.config['UPLOAD_FOLDER'], 'celestial.png') titre = os.path.join(app.config['UPLOAD_FOLDER'], 'titre.png') fleche = os.path.join(app.config['UPLOAD_FOLDER'], 'fleche.png') passage = os.path.join(app.config['UPLOAD_FOLDER'], 'passage.png') return render_template("resultat.html", frags=f, death=d, classe=c, toure=t, petit_logo=petit_logo, celestial=celestial, titre=titre, fleche=fleche, passage=passage) app.run(debug=True)