Feat(1NSI): requete POST et serveur bottle
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-13 15:14:16 +01:00
parent 4c71287f0e
commit 5b206949dd
6 changed files with 107 additions and 3 deletions

View File

@@ -0,0 +1,9 @@
@get('/formulaire')
def get_formulaire():
formulaire = """
<form method='post' action='bonjour'>
<input type='text' name='nom' placeholder='Votre nom ?'/>
<input type='submit' value='Bonjour bottle !'/>
</form>
"""
return template("modele_base.html", boby=formulaire)

View File

@@ -0,0 +1,6 @@
@post('/formulaire')
def bonjour() :
nom = bottle.request.forms.get('nom')
body = "<p>Bonjour mon(a) che(è)r(e) " + nom + "</p>"
return template("modele_base.py", body=body)

View File

@@ -0,0 +1,7 @@
from bottle import get, run, template
@get('/page/<utilisateur>')
def page_utilisateur(utilisateur):
return template("utilisateur.html", utilisateur=utilisateur)
run(host='localhost', port=8080, debug=True)

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang=fr>
<head>
<meta charset="UTF-8">
<meta name="Author" content="">
<title></title>
</head>
<body>
{{ body }}
</body>
</html>