From e225720f13fc1b001fa7e5f32dcfdb37d1dc6a3b Mon Sep 17 00:00:00 2001 From: wes Date: Wed, 22 Jun 2016 00:26:00 -0400 Subject: [PATCH] make blueprint routing work --- src/templates/search.html | 8 ++++---- src/website.py | 20 +++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/templates/search.html b/src/templates/search.html index 49c355c..55e8e73 100644 --- a/src/templates/search.html +++ b/src/templates/search.html @@ -29,15 +29,15 @@ {% block styles %} {{super()}} - - + + {% endblock %} {% block scripts %} {{super()}} - - + + {% endblock %} diff --git a/src/website.py b/src/website.py index 1a3358b..426fbf0 100755 --- a/src/website.py +++ b/src/website.py @@ -55,16 +55,7 @@ def cacheit(key, thunk): def ClassSearch(configfile=None): defaults = {"Day", "Building", "Exact Location", "Department"} - blueprint = Blueprint("website", __name__, template_folder="templates") - app = Flask(__name__) - app.register_blueprint(blueprint, url_prefix="/search") - AppConfig(app, configfile) # Flask-Appconfig is not necessary, but - # highly recommend =) - # https://github.com/mbr/flask-appconfig - Bootstrap(app) - - app.config["scripts"] = "./scripts" - app.config["styles"] = "./styles" + blueprint = Blueprint("TextBookSearch", __name__, template_folder="templates") @blueprint.route('/favicon.ico') def favicon(): @@ -94,6 +85,7 @@ def ClassSearch(configfile=None): @blueprint.route("/", methods=("GET", "POST")) def index(): + print "never reached?" return render_template("search.html") @blueprint.route("/fc", methods=("GET", "POST")) @@ -144,7 +136,13 @@ def ClassSearch(configfile=None): @blueprint.route("/styles/") def send_style(filename): return send_from_directory(app.config["styles"], filename) + + app = Flask(__name__) + app.register_blueprint(blueprint) + Bootstrap(app) + app.config["scripts"] = "./scripts" + app.config["styles"] = "./styles" return app if __name__ == "__main__": - ClassSearch("./appconfig").run(port=8001, debug=True) + ClassSearch("./appconfig").run(host="localhost", port=8001, debug=True)