Merge pull request #1 from LucienD/master
Make static pages view and favicon
This commit is contained in:
commit
47330be129
17
afpy.py
17
afpy.py
|
@ -1,7 +1,10 @@
|
|||
from pathlib import Path
|
||||
|
||||
import docutils.core
|
||||
import docutils.writers.html5_polyglot
|
||||
import feedparser
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, render_template, abort
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
@ -12,9 +15,17 @@ FEEDS = {
|
|||
}
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def page_not_found(e):
|
||||
return render_template('404.html'), 404
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
@app.route('/<template_name>')
|
||||
def pages(template_name='index'):
|
||||
if Path(f'templates/{template_name}.html').exists():
|
||||
return render_template(f'{template_name}.html')
|
||||
abort(404)
|
||||
|
||||
|
||||
@app.route('/docs/<name>')
|
||||
|
|
|
@ -1,2 +1,13 @@
|
|||
$nav-height: 48px
|
||||
|
||||
body
|
||||
background: blue
|
||||
margin: 0
|
||||
padding: 0
|
||||
|
||||
nav
|
||||
background: whitesmoke
|
||||
height: $nav-height
|
||||
display: flex
|
||||
a
|
||||
margin: 1em
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
body {
|
||||
background: blue; }
|
||||
background: blue;
|
||||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
nav {
|
||||
background: whitesmoke;
|
||||
height: 48px;
|
||||
display: flex; }
|
||||
nav a {
|
||||
margin: 1em; }
|
||||
|
||||
/*# sourceMappingURL=../static/css/style.sass.css.map */
|
|
@ -5,5 +5,5 @@
|
|||
"../../sass/style.sass"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAAA,AAAA,IAAI,CAAC;EACH,UAAU,EAAE,IAAI,GAAI"
|
||||
"mappings": "AAEA,AAAA,IAAI,CAAC;EACH,UAAU,EAAE,IAAI;EAChB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC,GAAI;;AAEhB,AAAA,GAAG,CAAC;EACF,UAAU,EAAE,UAAU;EACtB,MAAM,EATK,IAAI;EAUf,OAAO,EAAE,IAAI,GAEM;EALrB,AAIE,GAJC,CAID,CAAC,CAAC;IACA,MAAM,EAAE,GAAG,GAAI"
|
||||
}
|
BIN
static/images/favicon.ico
Normal file
BIN
static/images/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
7
templates/404.html
Normal file
7
templates/404.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% extends "_layout.jinja2" %}
|
||||
{% block title %}Page Not Found{% endblock %}
|
||||
{% block main %}
|
||||
<h1>Page Not Found</h1>
|
||||
<p>What you were looking for is just not there.
|
||||
<p><a href="{{ url_for('index') }}">go somewhere nice</a>
|
||||
{% endblock main %}
|
|
@ -1,9 +1,15 @@
|
|||
<html>
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="icon" href="{{ url_for('static', filename='images/favicon.ico') }}" />
|
||||
<title>{% block title %} AFPY - Le site web de l'Association Francophone de Python {% endblock title %}</title>
|
||||
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/style.sass.css') }}" />
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<a href="{{ url_for('pages') }}">Accueil</a>
|
||||
<a href="{{ url_for('pages', template_name='a-propos') }}">À propos</a>
|
||||
</nav>
|
||||
<main>
|
||||
{% block main %}{% endblock main %}
|
||||
|
|
6
templates/a-propos.html
Normal file
6
templates/a-propos.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{% extends '_layout.jinja2' %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
A propos
|
||||
{% endblock main %}
|
|
@ -1,5 +1,6 @@
|
|||
{% extends '_layout.jinja2' %}
|
||||
|
||||
|
||||
{% block main %}
|
||||
Test
|
||||
|
||||
{% endblock main %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user