Feat(1NSI): requete POST et serveur bottle
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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)
|
@@ -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)
|
@@ -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)
|
12
1NSI/05_Interaction_client-serveur/scripts/modele_base.html
Normal file
12
1NSI/05_Interaction_client-serveur/scripts/modele_base.html
Normal 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>
|
Reference in New Issue
Block a user