Merge branch 'master' of https://forge.chapril.org/CretinsMotorisesIngenieux/Marin
This commit is contained in:
commit
c6e5b48a13
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__/
|
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Équipe CMI - Nuit de l'Info 2021 - Sauveteurs Dunkerquois
|
||||
|
||||
## Dépendances
|
||||
|
||||
Ce site utilise [Python 3](https://www.python.org/), [Flask](https://palletsprojects.com/p/flask/), et [SQLite3](https://docs.python.org/3/library/sqlite3.html)
|
||||
|
||||
Flask doit être installé, SQLite3 est distribué avec la version classique de python.
|
||||
|
||||
```bash
|
||||
pip install flask
|
||||
```
|
||||
|
||||
## Lancer
|
||||
|
||||
Dans le dossier racine :
|
||||
|
||||
```bash
|
||||
flask run
|
||||
```
|
19
app.py
Normal file
19
app.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Fichier principal
|
||||
from flask import Flask, escape, request, url_for
|
||||
import pages
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
@app.route('/home')
|
||||
@app.route('/home/')
|
||||
def main():
|
||||
return pages.main()
|
||||
|
||||
@app.errorhandler(404)
|
||||
def error(e):
|
||||
return pages.error()
|
||||
|
||||
|
||||
if __name__=="__main__":
|
||||
app.run(debug=True)
|
8
definitions.py
Normal file
8
definitions.py
Normal file
@ -0,0 +1,8 @@
|
||||
### Fonctions communes
|
||||
|
||||
def read(path):
|
||||
# Retourne le contenu texte d'un fichier
|
||||
f = open(path,'r')
|
||||
result = f.read()
|
||||
f.close()
|
||||
return result
|
10
pages.py
Normal file
10
pages.py
Normal file
@ -0,0 +1,10 @@
|
||||
from flask import render_template
|
||||
import definitions as lib
|
||||
|
||||
# Fonctions qui seront associées à des URLs
|
||||
|
||||
def main():
|
||||
return render_template("index.html")
|
||||
|
||||
def error():
|
||||
return render_template("error.html")
|
17
static/style.css
Normal file
17
static/style.css
Normal file
@ -0,0 +1,17 @@
|
||||
body {
|
||||
}
|
||||
|
||||
h1 {
|
||||
}
|
||||
|
||||
p {
|
||||
}
|
||||
|
||||
table, tr, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table_key {
|
||||
font-weight: bold;
|
||||
}
|
0
temp infos
Normal file
0
temp infos
Normal file
11
templates/error.html
Normal file
11
templates/error.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link href="/static/style.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Erreur !</h1>
|
||||
<p>Retour à <a href="/home">la page d'accueil</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
24
templates/index.html
Normal file
24
templates/index.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Sauveteurs du dunkerquois</title>
|
||||
<link href="../static/style.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<div class="LOGO-DUO">
|
||||
<img src="https://sauveteurdudunkerquois.fr/wp-content/uploads/2021/09/LOGO-DUO.png" width="200"
|
||||
height="100">
|
||||
</div>
|
||||
<br>
|
||||
<form method="get" >
|
||||
<input type="text"
|
||||
placeholder="Rechercher un sauveteur, un bateau, une personne sauvée...">
|
||||
<input type="submit" value="Rechercher">
|
||||
</form>
|
||||
<br>
|
||||
<div>
|
||||
<button>Page au hasard</button>
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
28
templates/sauveteur_temp.html
Normal file
28
templates/sauveteur_temp.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{nom}} {{prenom}} - Sauveuteur du dunkerquois</title>
|
||||
<link href="../static/style.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>{{nom}} {{prenom}}</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="table_key">Nom</td><td>{{nom}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_key">Prénom</td><td>{{prenom}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_key">Sauvetages effectués</td><td>{{nb_sauvetages}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_key">Personnes sauvées</td><td>{{nb_sauves}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_key">Gratifications</td><td>{{gratifications}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>{{description}}</p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user