diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e5a5f5d --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +PYTHON=python3 +PYCODESTYLE=pycodestyle + +.DEFAULT_GOAL = help + +help: + @echo "The following targets are supported:" + @echo " setup install required packages" + @echo " test run the tests" + + +setup: + pip install -r requirements.txt + + +test: + ${PYCODESTYLE} *.py + ${PYTHON} -m pytest + +clean: + @echo "cleaning" + +.PHONY: setup test clean help diff --git a/app.py b/app.py index 1a6fe37..256528f 100755 --- a/app.py +++ b/app.py @@ -9,26 +9,31 @@ app.config['FLATPAGES_EXTENSION'] = '.md' pages = FlatPages(app) + @app.route('/.html') def page(path): page = pages.get_or_404(path) return render_template('page.html', page=page) + @app.route('/verein.html') def verein(): return render_template('verein.html') + @app.route('/impressum.html') def impressum(): return render_template('impressum.html') + @app.route('/') @app.route('/index.html') def index(): posts = [p for p in pages if "date" in p.meta] - sorted_pages = sorted(posts, reverse=True, key=lambda page: - datetime.strptime(page.meta["date"], "%d %b %y")) + sorted_pages = sorted(posts, reverse=True, key=lambda page + datetime.strptime(page.meta["date"], "%d %b %y")) return render_template('index.html', pages=sorted_pages) + if __name__ == '__main__': app.run(host='0.0.0.0') diff --git a/requirements.txt b/requirements.txt index cbc7c45..706464a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,8 @@ flask flask_flatpages + +pytest +pytest-cov +requests +pycodestyle +codecov