From fc2ad7e0c6d50bfa84d0a9db86484e140b97e391 Mon Sep 17 00:00:00 2001 From: chang-ning Date: Sun, 6 Mar 2016 01:19:30 +0800 Subject: [PATCH] Revert "Remove flask app" This reverts commit e5beed9339b0258cf9bbda47c87743def8a78fbc. --- Procfile | 1 + app.py | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Procfile create mode 100644 app.py diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..a5f41f8e --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: make && gunicorn app:app --log-file - diff --git a/app.py b/app.py new file mode 100644 index 00000000..22a05185 --- /dev/null +++ b/app.py @@ -0,0 +1,27 @@ +""" +This is a simple cheatsheet webapp. +""" +import os + +from flask import Flask, send_from_directory +from flask_sslify import SSLify + +DIR = os.path.dirname(os.path.realpath(__file__)) +ROOT = os.path.join(DIR, 'docs', '_build', 'html') + +app = Flask(__name__) +if 'DYNO' in os.environ: + sslify = SSLify(app) + +@app.route('/') +def static_proxy(path): + """Static files proxy""" + return send_from_directory(ROOT, path) + +@app.route('/') +def index_redirection(): + """Redirecting index file""" + return send_from_directory(ROOT, 'index.html') + +if __name__ == "__main__": + app.run(debug=True)