From 6c3290a96ecf1de0618790ff1573203fca9d5c4d Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Sat, 22 Feb 2014 23:38:56 +0100
Subject: [PATCH] Always give absolute template_folder and static_folder to
 Flask

For some reason, `pkg_resources.resource_filename` returns a relative path
if we call Mutalyzer using `python -m mutalyzer.entrypoints.*`. The path
is of course valid, but we pass it to Flask, which assumes relative paths
to be relative to the Python package root. To circumvent this incorrect
assumption, we first make the path absolute before passing it to Flask.
---
 mutalyzer/website/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mutalyzer/website/__init__.py b/mutalyzer/website/__init__.py
index 9a7e122d..37bb8eec 100644
--- a/mutalyzer/website/__init__.py
+++ b/mutalyzer/website/__init__.py
@@ -3,6 +3,7 @@ Mutalyzer website interface using the Flask framework.
 """
 
 
+import os
 import pkg_resources
 
 from flask import Flask
@@ -57,7 +58,8 @@ def create_app():
         'mutalyzer', 'website/templates/static')
 
     app = Flask('mutalyzer',
-                template_folder=template_folder, static_folder=static_folder)
+                template_folder=os.path.abspath(template_folder),
+                static_folder=os.path.abspath(static_folder))
 
     app.config.update(DEBUG=settings.DEBUG,
                       TESTING=settings.TESTING,
-- 
GitLab