--- a/server.py +++ b/server.py @@ -1,6 +1,6 @@ from flask import Flask from flask import request -from flask import render_template +from flask import render_template, url_for from flask import make_response from flask import jsonify import logging @@ -143,39 +143,39 @@ root = lxml.html.parse(StringIO.StringIO(page)).getroot() root.make_links_absolute(request.args['url'], resolve_base_href = True) # Log -- comment them - print "Page parsed.. Preparing to send.." + #print "Page parsed.. Preparing to send.." # inject the JS toolbar to annotate text jq = root.makeelement('script') - jq.set('src', '/static/jquery-1.9.1.min.js') + jq.set('src', url_for('static', filename='jquery-1.9.1.min.js')) script = root.makeelement('script') - script.set('src', '/static/text-annotation.js') + script.set('src', url_for('static', filename='text-annotation.js')) tree = root.makeelement('script') - tree.set('src', '/static/tree.js') + tree.set('src', url_for('static', filename='tree.js')) bs_js = root.makeelement('script') - bs_js.set('src', '/static/bootstrap.js') + bs_js.set('src', url_for('static', filename='bootstrap.js')) jit = root.makeelement('script') - jit.set('src', '/static/jit.js') + jit.set('src', url_for('static', filename='jit.js')) us = root.makeelement('script') - us.set('src', '/static/underscore-min-1.4.4.js') + us.set('src', url_for('static', filename='underscore-min-1.4.4.js')) link = root.makeelement('link') - link.set('href', '/static/text-annotation.css') + link.set('href', url_for('static', filename='text-annotation.css')) link.set('type', 'text/css') link.set('rel', 'stylesheet') bs = root.makeelement('link') - bs.set('href', '/static/bootstrap.css') + bs.set('href', url_for('static', filename='bootstrap.css')) bs.set('type', 'text/css') bs.set('rel', 'stylesheet') tree_css = root.makeelement('link') - tree_css.set('href', '/static/tree.css') + tree_css.set('href', url_for('static', filename='tree.css')) tree_css.set('type', 'text/css') tree_css.set('rel', 'stylesheet') --- a/templates/web.html +++ b/templates/web.html @@ -4,9 +4,9 @@