Commit 8818e450 authored by ConstiDami's avatar ConstiDami
Browse files

routes qui fonctionnent

parent 43262b24
......@@ -6,7 +6,6 @@ import sqlite3
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///prince.db'
app.config['PREFIX']='/projet_19-20/petit_prince'
app.jinja_env.add_extension('jinja2.ext.do')
app.jinja_env.add_extension('jinja2.ext.loopcontrols')
db = SQLAlchemy(app)
......
......@@ -3,37 +3,35 @@ from prince import app, db
from prince.models import Language, Sound
@app.route(PREFIX + '/')
@app.route(PREFIX + '/home')
#@app.route('/')
#@app.route('/home')
@app.route('/')
@app.route('/home')
def home():
prince_language = Language.query.filter_by(actif=1)
sounds = Sound.query.all()
return render_template('home.html', title='Petit Prince', prince_language = prince_language, sounds = sounds)
@app.route(PREFIX + '/liste_langues')
#@app.route('/liste_langues')
@app.route('/liste_langues')
def liste_langues():
prince_language = Language.query.filter_by(actif=1)
sounds = Sound.query.all()
return render_template('liste_langues.html', title='Liste des langues', prince_language = prince_language, sounds = sounds)
@app.route(PREFIX + '/langue/<lang>')
#@app.route('/langue/<lang>')
@app.route('/langue/<lang>')
def langue(lang):
langue_complet = Language.query.filter_by(french = lang).first()
sounds = Sound.query.filter_by(language = langue_complet.iso)
return render_template('langue.html', langue=langue_complet, title=lang, sounds = sounds)
@app.route(PREFIX + '/carte')
#@app.route('/carte')
@app.route('/carte')
def carte():
french = Language.french
prince_language = Language.query.filter_by(actif=1)
sounds = Sound.query.all()
return render_template('carte.html', title='Carte', prince_language=prince_language, sounds = sounds)
@app.route(PREFIX + '/enregistrement')
@app.route('/enregistrement')
def enregistrement():
return render_template('enregistrement.html', title='Enregistrer un audio')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment