Add flask freeze to make a static site

This commit is contained in:
Alexander Hosking 2017-06-01 13:55:06 -04:00
parent a796ccd29a
commit 4b59780b41
2 changed files with 7 additions and 1 deletions

View File

@ -1,9 +1,12 @@
appdirs==1.4.3
click==6.7 click==6.7
Flask==0.12 Flask==0.12
Frozen-Flask==0.14
itsdangerous==0.24 itsdangerous==0.24
Jinja2==2.9.5 Jinja2==2.9.5
MarkupSafe==0.23 MarkupSafe==0.23
packaging==16.8 packaging==16.8
pkg-resources==0.0.0
pyparsing==2.1.10 pyparsing==2.1.10
six==1.10.0 six==1.10.0
Werkzeug==0.11.15 Werkzeug==0.11.15

View File

@ -1,7 +1,9 @@
from flask import Flask, render_template, send_from_directory from flask import Flask, render_template, send_from_directory
from flask_frozen import Freezer
import os import os
app = Flask(__name__) app = Flask(__name__)
freezer = Freezer(app)
@app.route('/') @app.route('/')
@app.route('/index') @app.route('/index')
@ -44,7 +46,6 @@ def show_project(category, project_name):
@app.route('/projects/<category>/<project_name>/<filename>') @app.route('/projects/<category>/<project_name>/<filename>')
def show_project_file(category, project_name, filename): def show_project_file(category, project_name, filename):
return send_from_directory('projects/' + category + '/'+ project_name + '/', filename) return send_from_directory('projects/' + category + '/'+ project_name + '/', filename)
# return 'projects/' + category + '/'+ project_name + '/', filename
@app.route('/about') @app.route('/about')
def about(): def about():
@ -64,3 +65,5 @@ def portfolio():
def contact(): def contact():
return render_template('contactus.html', title="Contact Us - JPs Contracting") return render_template('contactus.html', title="Contact Us - JPs Contracting")
if __name__ == '__main__':
freezer.freeze()