[tor-commits] [compass/master] Fixed relative path urls for apache
karsten at torproject.org
karsten at torproject.org
Mon Jan 7 07:09:40 UTC 2013
commit 9e9e9db8b2eb172540c74053eee5195d29605c8d
Author: Chris Wacek <cwacek at cs.georgetown.edu>
Date: Mon Dec 31 11:28:44 2012 -0500
Fixed relative path urls for apache
---
app.py | 3 ++-
templates/index.html | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app.py b/app.py
index 5e78d05..f323ebc 100644
--- a/app.py
+++ b/app.py
@@ -113,7 +113,8 @@ def parse(output_string, grouping=False, sort_key=None):
@app.route('/')
def index():
- return app.open_resource("templates/index.html").read()
+
+ return app.open_resource("templates/index.html").read().replace('<!--%script_root%-->',request.script_root)
@app.route('/result.json', methods=['GET'])
def json_result():
diff --git a/templates/index.html b/templates/index.html
index 5105d28..158ae53 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -2,6 +2,11 @@
<html lang="en" ng-app="Compass">
<head>
<meta charset="utf-8">
+ <!-- This sets the relative base_url for the app, which
+ is necessary if its not running from the root.
+ Flask replaces this %script_root% piece with the
+ right path-->
+ <base href="<!--%script_root%-->/">
<title>Compass</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Tor relay stats">
@@ -160,7 +165,7 @@
</div>
<div class="hero-unit" ng-show="state == 'loading'" >
- <div class='loading'><img src="/static/img/loader.gif" /></div>
+ <div class='loading'><img src="static/img/loader.gif" /></div>
</div>
<div class="hero-unit" ng-show="state == 'result_empty'">
<p>No results found</p>
More information about the tor-commits
mailing list