2018-04-29 13:47:47 +00:00
|
|
|
|
import email
|
2017-09-22 14:42:56 +00:00
|
|
|
|
import locale
|
2018-05-11 16:54:42 +00:00
|
|
|
|
import os
|
2018-04-29 13:47:47 +00:00
|
|
|
|
import time
|
2018-04-29 23:36:46 +00:00
|
|
|
|
from pathlib import Path
|
|
|
|
|
from xml.etree import ElementTree
|
2017-09-22 14:42:56 +00:00
|
|
|
|
|
2017-09-21 15:20:00 +00:00
|
|
|
|
import docutils.core
|
|
|
|
|
import docutils.writers.html5_polyglot
|
2017-09-21 15:40:18 +00:00
|
|
|
|
import feedparser
|
2018-05-02 21:52:41 +00:00
|
|
|
|
from dateutil.parser import parse
|
2018-06-05 10:34:49 +00:00
|
|
|
|
from flask import (Flask, abort, jsonify, redirect, render_template, request,
|
|
|
|
|
send_from_directory, url_for)
|
2018-04-29 13:47:47 +00:00
|
|
|
|
from flask_cache import Cache
|
2018-05-11 16:54:42 +00:00
|
|
|
|
from itsdangerous import BadSignature, URLSafeSerializer
|
2017-09-21 17:06:27 +00:00
|
|
|
|
from jinja2 import TemplateNotFound
|
2017-09-21 14:34:26 +00:00
|
|
|
|
|
2017-12-07 17:26:55 +00:00
|
|
|
|
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
|
2017-09-22 14:42:56 +00:00
|
|
|
|
|
2018-04-29 13:47:47 +00:00
|
|
|
|
cache = Cache(config={'CACHE_TYPE': 'simple', 'CACHE_DEFAULT_TIMEOUT': 600})
|
2018-05-11 14:32:38 +00:00
|
|
|
|
signer = URLSafeSerializer(os.environ.get('SECRET', 'changeme!'))
|
2017-09-21 14:34:26 +00:00
|
|
|
|
app = Flask(__name__)
|
2018-04-29 13:47:47 +00:00
|
|
|
|
cache.init_app(app)
|
2017-09-21 14:34:26 +00:00
|
|
|
|
|
2018-05-11 15:07:13 +00:00
|
|
|
|
PAGINATION = 12
|
|
|
|
|
|
2018-04-29 13:47:47 +00:00
|
|
|
|
PLANET = {
|
2018-05-05 12:07:05 +00:00
|
|
|
|
'Emplois AFPy': 'https://www.afpy.org/feed/emplois/rss.xml',
|
|
|
|
|
'Nouvelles AFPy': 'https://www.afpy.org/feed/actualites/rss.xml',
|
2018-04-29 13:47:47 +00:00
|
|
|
|
'Anybox': 'https://anybox.fr/site-feed/RSS?set_language=fr',
|
|
|
|
|
'Ascendances': 'https://ascendances.wordpress.com/feed/',
|
|
|
|
|
'Code en Seine': 'https://codeenseine.fr/feeds/all.atom.xml',
|
|
|
|
|
'Yaal': 'https://www.yaal.fr/blog/feeds/all.atom.xml'
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 16:32:31 +00:00
|
|
|
|
MEETUPS = {
|
2018-05-16 19:17:32 +00:00
|
|
|
|
'amiens': 'https://www.meetup.com/fr-FR/Python-Amiens',
|
2017-09-22 13:24:37 +00:00
|
|
|
|
'bruxelles': (
|
|
|
|
|
'https://www.meetup.com/fr-FR/'
|
2018-04-06 14:47:02 +00:00
|
|
|
|
'Belgium-Python-Meetup-aka-AperoPythonBe/'),
|
2017-09-22 13:37:15 +00:00
|
|
|
|
'grenoble': (
|
2018-04-06 14:47:02 +00:00
|
|
|
|
'https://www.meetup.com/fr-FR/Groupe-dutilisateurs-Python-Grenoble/'),
|
|
|
|
|
'lille': 'https://www.meetup.com/fr-FR/Lille-py/',
|
|
|
|
|
'lyon': 'https://www.meetup.com/fr-FR/Python-AFPY-Lyon/',
|
|
|
|
|
'nantes': 'https://www.meetup.com/fr-FR/Nantes-Python-Meetup/',
|
|
|
|
|
'montpellier': 'https://www.meetup.com/fr-FR/Meetup-Python-Montpellier/',
|
2017-09-21 16:32:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-29 23:36:46 +00:00
|
|
|
|
POSTS = {
|
|
|
|
|
'actualites': 'Actualités',
|
2018-04-30 12:10:54 +00:00
|
|
|
|
'emplois': 'Offres d’emploi',
|
2018-04-29 23:36:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
root = Path(__file__).parent / 'posts'
|
|
|
|
|
for category in POSTS:
|
|
|
|
|
for status in ('waiting', 'published'):
|
|
|
|
|
(root / category / status).mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
2017-09-21 14:34:26 +00:00
|
|
|
|
|
2017-09-21 15:50:24 +00:00
|
|
|
|
@app.errorhandler(404)
|
|
|
|
|
def page_not_found(e):
|
|
|
|
|
return render_template('404.html'), 404
|
|
|
|
|
|
|
|
|
|
|
2017-09-21 14:34:26 +00:00
|
|
|
|
@app.route('/')
|
2018-04-30 12:10:54 +00:00
|
|
|
|
def index():
|
2018-04-29 23:36:46 +00:00
|
|
|
|
posts = {}
|
2018-04-30 12:10:54 +00:00
|
|
|
|
path = root / 'actualites' / 'published'
|
|
|
|
|
timestamps = sorted(path.iterdir(), reverse=True)[:4]
|
|
|
|
|
for timestamp in timestamps:
|
|
|
|
|
tree = ElementTree.parse(timestamp / 'post.xml')
|
|
|
|
|
posts[timestamp.name] = {item.tag: item.text for item in tree.iter()}
|
2018-05-04 20:54:23 +00:00
|
|
|
|
if (timestamp / 'post.jpg').is_file():
|
|
|
|
|
posts[timestamp.name]['image'] = '/'.join((
|
|
|
|
|
'actualites', 'published', timestamp.name))
|
2018-04-30 12:10:54 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
'index.html', body_id='index', name='actualites', posts=posts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/<name>')
|
|
|
|
|
def pages(name):
|
2017-09-22 12:11:38 +00:00
|
|
|
|
if name == 'index':
|
2018-04-30 12:10:54 +00:00
|
|
|
|
return redirect(url_for('index'))
|
2017-09-21 17:06:27 +00:00
|
|
|
|
try:
|
2018-04-30 12:10:54 +00:00
|
|
|
|
return render_template(f'{name}.html', body_id=name, meetups=MEETUPS)
|
2017-09-21 17:06:27 +00:00
|
|
|
|
except TemplateNotFound:
|
|
|
|
|
abort(404)
|
2017-09-21 14:34:26 +00:00
|
|
|
|
|
|
|
|
|
|
2017-09-21 15:20:00 +00:00
|
|
|
|
@app.route('/docs/<name>')
|
|
|
|
|
def rest(name):
|
2017-09-22 14:22:25 +00:00
|
|
|
|
try:
|
|
|
|
|
with open(f'templates/{name}.rst') as fd:
|
|
|
|
|
parts = docutils.core.publish_parts(
|
|
|
|
|
source=fd.read(),
|
|
|
|
|
writer=docutils.writers.html5_polyglot.Writer(),
|
|
|
|
|
settings_overrides={'initial_header_level': 2})
|
|
|
|
|
except FileNotFoundError:
|
|
|
|
|
abort(404)
|
2017-09-22 10:11:26 +00:00
|
|
|
|
return render_template(
|
|
|
|
|
'rst.html', body_id=name, html=parts['body'], title=parts['title'])
|
2017-09-21 15:20:00 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-11 14:32:38 +00:00
|
|
|
|
def _get_post(name, timestamp):
|
|
|
|
|
for state in ('waiting', 'published'):
|
|
|
|
|
path = (root / name / state / timestamp / 'post.xml')
|
|
|
|
|
if path.is_file():
|
|
|
|
|
break
|
|
|
|
|
else:
|
|
|
|
|
return None
|
|
|
|
|
tree = ElementTree.parse(path)
|
|
|
|
|
post = {item.tag: (item.text or '').strip() for item in tree.iter()}
|
|
|
|
|
post['state'] = state
|
|
|
|
|
post['timestamp'] = timestamp
|
|
|
|
|
return post
|
|
|
|
|
|
|
|
|
|
|
2018-04-30 12:10:54 +00:00
|
|
|
|
@app.route('/post/edit/<name>')
|
2018-05-11 14:32:38 +00:00
|
|
|
|
@app.route('/post/edit/<name>/token/<token>')
|
|
|
|
|
def edit_post(name, token=None):
|
2018-04-30 12:10:54 +00:00
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
if token:
|
|
|
|
|
try:
|
|
|
|
|
timestamp = signer.loads(token)
|
|
|
|
|
except BadSignature:
|
|
|
|
|
abort(401)
|
|
|
|
|
post = _get_post(name, timestamp)
|
|
|
|
|
if not post:
|
2018-04-30 12:10:54 +00:00
|
|
|
|
abort(404)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
else:
|
|
|
|
|
post = {'state': 'waiting'}
|
|
|
|
|
if post['state'] != 'waiting':
|
|
|
|
|
return redirect(url_for('rest', name='already_published'))
|
2018-04-30 12:10:54 +00:00
|
|
|
|
return render_template(
|
2018-05-11 16:54:42 +00:00
|
|
|
|
'edit_post.html', body_id='edit-post', post=post, name=name,
|
|
|
|
|
admin=False)
|
2018-04-30 12:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-11 14:32:38 +00:00
|
|
|
|
@app.route('/admin/post/edit/<name>/<timestamp>')
|
|
|
|
|
def edit_post_admin(name, timestamp):
|
2018-04-30 12:10:54 +00:00
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
post = _get_post(name, timestamp)
|
|
|
|
|
if not post:
|
|
|
|
|
abort(404)
|
|
|
|
|
return render_template(
|
2018-05-11 16:54:42 +00:00
|
|
|
|
'edit_post.html', body_id='edit-post', post=post, name=name,
|
|
|
|
|
admin=True)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _save_post(name, timestamp, admin):
|
2018-04-30 12:10:54 +00:00
|
|
|
|
if timestamp is None:
|
|
|
|
|
timestamp = str(int(time.time()))
|
|
|
|
|
status = 'waiting'
|
|
|
|
|
folder = root / name / 'waiting' / timestamp
|
|
|
|
|
folder.mkdir()
|
|
|
|
|
post = folder / 'post.xml'
|
|
|
|
|
elif (root / name / 'waiting' / timestamp / 'post.xml').is_file():
|
|
|
|
|
status = 'waiting'
|
|
|
|
|
elif (root / name / 'published' / timestamp / 'post.xml').is_file():
|
|
|
|
|
status = 'published'
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
|
|
|
|
|
if status == 'published' and not admin:
|
|
|
|
|
abort(401)
|
|
|
|
|
|
2018-04-30 12:10:54 +00:00
|
|
|
|
post = root / name / status / timestamp / 'post.xml'
|
2018-05-10 16:10:17 +00:00
|
|
|
|
tree = ElementTree.Element('entry')
|
2018-05-02 21:52:41 +00:00
|
|
|
|
for key, value in request.form.items():
|
2018-04-30 12:10:54 +00:00
|
|
|
|
element = ElementTree.SubElement(tree, key)
|
2018-05-02 21:52:41 +00:00
|
|
|
|
element.text = value
|
|
|
|
|
element = ElementTree.SubElement(tree, 'published')
|
2018-04-30 12:10:54 +00:00
|
|
|
|
element.text = email.utils.formatdate(
|
|
|
|
|
int(timestamp) if timestamp else time.time())
|
|
|
|
|
ElementTree.ElementTree(tree).write(post)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
|
|
|
|
|
if admin:
|
2018-04-30 20:00:41 +00:00
|
|
|
|
if 'publish' in request.form and status == 'waiting':
|
|
|
|
|
(root / name / 'waiting' / timestamp).rename(
|
|
|
|
|
root / name / 'published' / timestamp)
|
|
|
|
|
elif 'unpublish' in request.form and status == 'published':
|
|
|
|
|
(root / name / 'published' / timestamp).rename(
|
|
|
|
|
root / name / 'waiting' / timestamp)
|
2018-05-11 14:32:38 +00:00
|
|
|
|
|
|
|
|
|
return _get_post(name, timestamp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/post/edit/<name>', methods=['post'])
|
|
|
|
|
@app.route('/post/edit/<name>/token/<token>', methods=['post'])
|
|
|
|
|
def save_post(name, token=None):
|
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
|
|
|
|
if token:
|
|
|
|
|
try:
|
|
|
|
|
timestamp = signer.loads(token)
|
|
|
|
|
except BadSignature:
|
|
|
|
|
abort(401)
|
|
|
|
|
else:
|
|
|
|
|
timestamp = None
|
|
|
|
|
post = _save_post(name, timestamp=timestamp, admin=False)
|
|
|
|
|
edit_post_url = url_for(
|
|
|
|
|
'edit_post', name=name, token=signer.dumps(post['timestamp']))
|
|
|
|
|
return render_template('confirmation.html', edit_post_url=edit_post_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/admin/post/edit/<name>/<timestamp>', methods=['post'])
|
|
|
|
|
def save_post_admin(name, timestamp):
|
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
|
|
|
|
_save_post(name, timestamp=timestamp, admin=True)
|
|
|
|
|
return redirect(url_for('admin', name=name))
|
2018-04-30 12:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
2018-04-29 23:36:46 +00:00
|
|
|
|
@app.route('/posts/<name>')
|
2018-05-11 15:07:13 +00:00
|
|
|
|
@app.route('/posts/<name>/page/<int:page>')
|
|
|
|
|
def posts(name, page=1):
|
2018-04-29 23:36:46 +00:00
|
|
|
|
if name not in POSTS:
|
2017-09-22 14:22:25 +00:00
|
|
|
|
abort(404)
|
2018-04-29 23:36:46 +00:00
|
|
|
|
path = root / name / 'published'
|
2018-05-11 15:07:13 +00:00
|
|
|
|
timestamps = sorted(path.iterdir(), reverse=True)
|
|
|
|
|
end = page * PAGINATION
|
|
|
|
|
start = end - PAGINATION
|
|
|
|
|
total_pages = (len(timestamps) // PAGINATION) + 1
|
2018-04-29 23:36:46 +00:00
|
|
|
|
posts = {}
|
2018-05-11 15:07:13 +00:00
|
|
|
|
for timestamp in timestamps[start:end]:
|
2018-04-29 23:36:46 +00:00
|
|
|
|
tree = ElementTree.parse(timestamp / 'post.xml')
|
2018-04-30 12:10:54 +00:00
|
|
|
|
posts[timestamp.name] = {item.tag: item.text for item in tree.iter()}
|
2018-05-04 20:54:23 +00:00
|
|
|
|
if (timestamp / 'post.jpg').is_file():
|
|
|
|
|
posts[timestamp.name]['image'] = '/'.join((
|
|
|
|
|
name, 'published', timestamp.name))
|
2017-09-22 10:11:26 +00:00
|
|
|
|
return render_template(
|
2018-05-11 15:07:13 +00:00
|
|
|
|
'posts.html', body_id=name, posts=posts, title=POSTS[name], name=name,
|
|
|
|
|
page=page, total_pages=total_pages)
|
2018-04-29 23:36:46 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-02 21:52:41 +00:00
|
|
|
|
@app.route('/admin/posts/<name>')
|
|
|
|
|
def admin(name):
|
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
2018-04-30 20:00:41 +00:00
|
|
|
|
posts = {}
|
2018-05-02 21:52:41 +00:00
|
|
|
|
for state in ('waiting', 'published'):
|
|
|
|
|
posts[state] = state_posts = {}
|
|
|
|
|
timestamps = sorted((root / name / state).iterdir(), reverse=True)
|
|
|
|
|
for timestamp in timestamps:
|
|
|
|
|
tree = ElementTree.parse(timestamp / 'post.xml')
|
|
|
|
|
state_posts[timestamp.name] = {
|
|
|
|
|
item.tag: item.text for item in tree.iter()}
|
|
|
|
|
return render_template(
|
|
|
|
|
'admin.html', body_id='admin', posts=posts, title=POSTS[name],
|
|
|
|
|
name=name)
|
2018-04-30 20:00:41 +00:00
|
|
|
|
|
|
|
|
|
|
2018-04-29 23:36:46 +00:00
|
|
|
|
@app.route('/posts/<name>/<timestamp>')
|
|
|
|
|
def post(name, timestamp):
|
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
|
|
|
|
try:
|
2018-05-04 20:54:23 +00:00
|
|
|
|
path = root / name / 'published' / timestamp
|
|
|
|
|
tree = ElementTree.parse(path / 'post.xml')
|
2018-04-29 23:36:46 +00:00
|
|
|
|
except Exception:
|
|
|
|
|
abort(404)
|
|
|
|
|
post = {item.tag: item.text for item in tree.iter()}
|
2018-05-04 20:54:23 +00:00
|
|
|
|
if (path / 'post.jpg').is_file():
|
|
|
|
|
post['image'] = '/'.join((name, 'published', timestamp))
|
2018-05-02 21:52:41 +00:00
|
|
|
|
return render_template('post.html', body_id='post', post=post, name=name)
|
2017-09-21 15:40:18 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-04 20:54:23 +00:00
|
|
|
|
@app.route('/post_image/<path:path>/post.jpg')
|
|
|
|
|
def post_image(path):
|
|
|
|
|
if path.count('/') != 2:
|
|
|
|
|
abort(404)
|
|
|
|
|
name, status, timestamp = path.split('/')
|
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
|
|
|
|
if status not in ('published', 'waiting'):
|
|
|
|
|
abort(404)
|
|
|
|
|
return send_from_directory(root / path, 'post.jpg')
|
|
|
|
|
|
|
|
|
|
|
2018-04-30 13:03:16 +00:00
|
|
|
|
@app.route('/feed/<name>/rss.xml')
|
|
|
|
|
@cache.cached()
|
|
|
|
|
def feed(name):
|
|
|
|
|
if name not in POSTS:
|
|
|
|
|
abort(404)
|
|
|
|
|
path = root / name / 'published'
|
2018-05-02 21:52:41 +00:00
|
|
|
|
timestamps = sorted(path.iterdir(), reverse=True)[:50]
|
2018-04-30 13:03:16 +00:00
|
|
|
|
entries = []
|
|
|
|
|
for timestamp in timestamps:
|
|
|
|
|
tree = ElementTree.parse(timestamp / 'post.xml')
|
|
|
|
|
entry = {item.tag: item.text for item in tree.iter()}
|
|
|
|
|
entry['timestamp'] = int(timestamp.name)
|
|
|
|
|
entry['link'] = url_for(
|
|
|
|
|
'post', name=name, timestamp=timestamp.name, _external=True)
|
|
|
|
|
entries.append({'content': entry})
|
|
|
|
|
title = f'{POSTS[name]} AFPy.org'
|
|
|
|
|
return render_template(
|
|
|
|
|
'rss.xml', entries=entries, title=title, description=title,
|
|
|
|
|
link=url_for('feed', name=name, _external=True))
|
|
|
|
|
|
|
|
|
|
|
2018-04-29 13:47:47 +00:00
|
|
|
|
@app.route('/planet/')
|
2018-04-26 13:23:02 +00:00
|
|
|
|
@app.route('/planet/rss.xml')
|
2018-04-29 14:56:23 +00:00
|
|
|
|
@cache.cached()
|
2018-04-26 13:23:02 +00:00
|
|
|
|
def planet():
|
2018-04-29 13:47:47 +00:00
|
|
|
|
entries = []
|
|
|
|
|
for name, url in PLANET.items():
|
|
|
|
|
for entry in feedparser.parse(url).entries:
|
2018-04-30 13:03:16 +00:00
|
|
|
|
date = getattr(entry, 'published_parsed', entry.updated_parsed)
|
|
|
|
|
entry['timestamp'] = time.mktime(date)
|
2018-04-29 13:47:47 +00:00
|
|
|
|
entries.append({'feed': name, 'content': entry})
|
2018-04-30 13:03:16 +00:00
|
|
|
|
entries.sort(reverse=True, key=lambda entry: entry['content']['timestamp'])
|
|
|
|
|
return render_template(
|
|
|
|
|
'rss.xml', entries=entries, title='Planet Python francophone',
|
|
|
|
|
description='Nouvelles autour de Python en français',
|
|
|
|
|
link=url_for('planet', _external=True))
|
2018-04-26 13:23:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/rss-jobs/RSS')
|
|
|
|
|
def jobs():
|
|
|
|
|
return redirect('https://plone.afpy.org/rss-jobs/RSS', code=307)
|
|
|
|
|
|
|
|
|
|
|
2018-06-10 17:46:06 +00:00
|
|
|
|
@app.route('/status')
|
|
|
|
|
def status():
|
2018-06-04 10:04:13 +00:00
|
|
|
|
stats = {}
|
|
|
|
|
for category in POSTS:
|
|
|
|
|
stats[category] = {}
|
|
|
|
|
for status in ('waiting', 'published'):
|
2018-06-05 18:19:25 +00:00
|
|
|
|
stats[category][status] = len(list(
|
|
|
|
|
(root / category / status).iterdir()))
|
2018-06-04 10:04:13 +00:00
|
|
|
|
|
2018-06-10 17:46:06 +00:00
|
|
|
|
os_stats = os.statvfs(__file__)
|
|
|
|
|
stats['disk_free'] = os_stats.f_bavail * os_stats.f_frsize
|
|
|
|
|
stats['disk_total'] = os_stats.f_blocks * os_stats.f_frsize
|
|
|
|
|
stats['load_avg'] = os.getloadavg()
|
2018-06-04 10:04:13 +00:00
|
|
|
|
|
|
|
|
|
return jsonify(stats)
|
|
|
|
|
|
|
|
|
|
|
2018-04-29 13:47:47 +00:00
|
|
|
|
@app.template_filter('rfc822_datetime')
|
2018-04-30 13:03:16 +00:00
|
|
|
|
def format_rfc822_datetime(timestamp):
|
|
|
|
|
return email.utils.formatdate(timestamp)
|
2018-04-29 13:47:47 +00:00
|
|
|
|
|
|
|
|
|
|
2018-05-02 21:52:41 +00:00
|
|
|
|
@app.template_filter('parse_iso_datetime')
|
|
|
|
|
def parse_iso_datetime(iso_datetime, format_):
|
|
|
|
|
return parse(iso_datetime).strftime(format_)
|
|
|
|
|
|
|
|
|
|
|
2018-04-30 12:21:03 +00:00
|
|
|
|
if app.env == 'development': # pragma: no cover
|
2017-09-21 14:34:26 +00:00
|
|
|
|
from sassutils.wsgi import SassMiddleware
|
2017-09-22 09:30:21 +00:00
|
|
|
|
app.wsgi_app = SassMiddleware(
|
|
|
|
|
app.wsgi_app, {'afpy': ('sass', 'static/css', '/static/css')})
|