From 4b59780b41134e2efa45ade437535edd707ca3ca Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Thu, 1 Jun 2017 13:55:06 -0400 Subject: [PATCH] Add flask freeze to make a static site --- requirements.txt | 3 +++ run_site.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8cba2bc..50a7f9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,12 @@ +appdirs==1.4.3 click==6.7 Flask==0.12 +Frozen-Flask==0.14 itsdangerous==0.24 Jinja2==2.9.5 MarkupSafe==0.23 packaging==16.8 +pkg-resources==0.0.0 pyparsing==2.1.10 six==1.10.0 Werkzeug==0.11.15 diff --git a/run_site.py b/run_site.py index e0fc984..525ae80 100644 --- a/run_site.py +++ b/run_site.py @@ -1,7 +1,9 @@ from flask import Flask, render_template, send_from_directory +from flask_frozen import Freezer import os app = Flask(__name__) +freezer = Freezer(app) @app.route('/') @app.route('/index') @@ -44,7 +46,6 @@ def show_project(category, project_name): @app.route('/projects///') def show_project_file(category, project_name, filename): return send_from_directory('projects/' + category + '/'+ project_name + '/', filename) - # return 'projects/' + category + '/'+ project_name + '/', filename @app.route('/about') def about(): @@ -64,3 +65,5 @@ def portfolio(): def contact(): return render_template('contactus.html', title="Contact Us - JPs Contracting") +if __name__ == '__main__': + freezer.freeze()