From 6999cb060292dd179c30ecbb236c76ae75521180 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20T=C3=A9tard?= Date: Thu, 12 Nov 2015 10:16:47 +0100 Subject: [PATCH] Utilisation de Flask-bootstrap --- femtoblackweb.py | 9 +- requirements.txt | 3 + templates/404.html | 9 +- templates/analyze_file.html | 187 ++++++++++++++++++------------------ templates/index.html | 12 ++- templates/layout.html | 34 ++----- templates/testio.html | 88 ----------------- templates/upload.html | 52 +++++----- 8 files changed, 157 insertions(+), 237 deletions(-) delete mode 100644 templates/testio.html diff --git a/femtoblackweb.py b/femtoblackweb.py index 2ba0f90..8c0b2bd 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -22,11 +22,14 @@ app.config.update({ 'SECRET_KEY': 'Eheucahduugei3aiyau3kizua%', 'USERNAME': 'admin', 'PASSWORD': 'default', - 'UPLOAD_FOLDER': '/home/bot/flask/uploads', - 'MAX_CONTENT_LENGTH': 50 * 1024 * 1024 + 'UPLOAD_FOLDER': os.path.join(os.path.dirname(os.path.realpath(__file__)), 'uploads'), + 'MAX_CONTENT_LENGTH': 50 * 1024 * 1024, + 'BOOTSTRAP_SERVE_LOCAL': True, + 'BOOTSTRAP_QUERYSTRING_REVVING': True, }) -app.config.from_envvar('FLASKR_SETTINGS', silent=True) +app.config.from_envvar('FEMTOBLACK_SETTINGS', silent=True) +Bootstrap(app) socketio = SocketIO(app) @app.errorhandler(404) diff --git a/requirements.txt b/requirements.txt index 9752b21..005711d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,14 @@ Flask==0.10.1 +Flask-Bootstrap==3.3.5.7 Flask-SocketIO==1.0 Jinja2==2.8 MarkupSafe==0.23 Werkzeug==0.10.4 +dominate==2.1.16 eventlet==0.17.4 greenlet==0.4.9 itsdangerous==0.24 python-engineio==0.7.1 python-socketio==0.6.1 six==1.10.0 +visitor==0.1.2 diff --git a/templates/404.html b/templates/404.html index 917df1e..902608e 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,6 +1,11 @@ +{# -*- mode: jinja2 -*- #} {% extends "layout.html" %} -{% block title %}Page non existante{% endblock %} -{% block body %} + +{% block femto_title %}Page non existante{% endblock %} + +{% block femto_content %} +

Cette page est non existante.

go somewhere nice

+ {% endblock %} diff --git a/templates/analyze_file.html b/templates/analyze_file.html index c0a752e..071d86f 100644 --- a/templates/analyze_file.html +++ b/templates/analyze_file.html @@ -1,116 +1,121 @@ +{# -*- mode: jinja2 -*- #} {% extends "layout.html" %} -{% block body %} -

Analyse d’un nouveau fichier son : {{ filename }}

-
-
+{% block femto_title %}Analyse d’un nouveau fichier son : {{ filename }}{% endblock %} -
+{% block femto_content %} -
-
+
+
-
- -
+
-
+
+
-
-
- - - -
-
+
+ +
-
-
-
0:00
-
-
-
-
-
-
-
0:00
-
-
+
+
+
+ + +
- -
-
- - volume +
+ +
+
+
0:00
+
+
+
+
+
+
0:00
-
+
-
+
-
-
-
+
+
+ + volume +
+
+
- - -
- - - -
+
-
+
+
+
-
+ - +
-
- -
+ + +
+
+ +
+ + +
+ +
+
+
-
-
- - - + +
+
+
+{% endblock %} + +{% block scripts %} + {{ super() }} + {% endblock %} diff --git a/templates/index.html b/templates/index.html index b2be837..065efbe 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,8 +1,10 @@ +{# -*- mode: jinja2 -*- #} {% extends "layout.html" %} -{% block body %} -

Sommaire (très, oui)

- +{% block femto_title %}Accueil{% endblock %} + +{% block femto_content %} + {% endblock %} diff --git a/templates/layout.html b/templates/layout.html index 45ea333..d256650 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -1,27 +1,11 @@ - - - - - - +{# -*- mode: jinja2 -*- #} +{% extends "bootstrap/base.html" %} +{% block title %}Femtoblackpool{% endblock %} - Femtoblackpool +{% block content %} +
+

Femtoblackpool // {% block femto_title %}{% endblock %}{% block femto_main_title %}{% endblock %}

- - - - - - - - - - - - -
-

Femtoblack. Pull!

- {% block body %}{% endblock %} -
- - + {% block femto_content %}{% endblock %} +
+{% endblock %} diff --git a/templates/testio.html b/templates/testio.html deleted file mode 100644 index a786038..0000000 --- a/templates/testio.html +++ /dev/null @@ -1,88 +0,0 @@ -{% extends "layout.html" %} -{% block body %} - -
- - -
-
- - -
-
- - -
-
- - -
-
- - - -
-
- - -
-
- -
-

Receive:

-
- - - - - -{% endblock %} diff --git a/templates/upload.html b/templates/upload.html index c004e62..0abdef7 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -1,8 +1,11 @@ +{# -*- mode: jinja2 -*- #} {% extends "layout.html" %} -{% block body %} -

Analyser un nouveau fichier son

-
+{% block femto_title %}Analyser un nouveau fichier son{% endblock %} + +{% block femto_content %} + +

@@ -16,28 +19,32 @@
-
- - +} + {% endblock %} -- 2.30.2