diff options
author | 2018-02-05 12:22:49 +0000 | |
---|---|---|
committer | 2018-02-05 12:22:49 +0000 | |
commit | beaa61362aed31f229c935a347e382024eee5a90 (patch) | |
tree | 4d9cf54e44b7fea4124389098fd0fa37a17cdad9 /app.py | |
parent | Add templates & static folder with .gitkeep's (diff) |
Dynamic route loader; proper application structure
Also fixed flake8-imports getting the other wrong
Diffstat (limited to 'app.py')
-rw-r--r-- | app.py | 35 |
1 files changed, 5 insertions, 30 deletions
@@ -1,35 +1,10 @@ -#!/usr/bin/env python3 +# coding=utf-8 -import os +from pysite.route_manager import RouteManager -from flask import Flask -from flask import jsonify -from flask import redirect - -app = Flask(__name__) - -app.secret_key = os.environ.get("WEBPAGE_SECRET_KEY") - - [email protected]("/") -def index(): - return "Coming soon:tm:" - - [email protected]("/invite") -def invite(): - return redirect("http://invite.pythondiscord.com/") - - [email protected]("/healthcheck") -def healthcheck(): - return jsonify({"status": "ok"}) - - [email protected](404) -def page_not_found(e): - return "replace me with a template, 404 not found", 404 +manager = RouteManager() +app = manager.app if __name__ == '__main__': - app.run(port=int(os.environ.get("WEBPAGE_PORT")), debug=False) + manager.run() |