From 6ad7f85e76457f619631f0752afa4f50bdf156bc Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 29 Jan 2018 15:08:25 +0100 Subject: [PATCH] A more clever way to get the static dirs --- platypush/backend/http/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platypush/backend/http/__init__.py b/platypush/backend/http/__init__.py index ea7d90cc..71d504e2 100644 --- a/platypush/backend/http/__init__.py +++ b/platypush/backend/http/__init__.py @@ -1,4 +1,5 @@ import asyncio +import inspect import logging import json import os @@ -63,8 +64,9 @@ class HttpBackend(Backend): def webserver(self): - template_dir = os.path.join(os.getcwd(),'platypush','backend','http','templates') - static_dir = os.path.join(os.getcwd(),'platypush','backend','http','static') + basedir = os.path.dirname(inspect.getfile(self.__class__)) + template_dir = os.path.join(basedir, 'templates') + static_dir = os.path.join(basedir, 'static') app = Flask(__name__, template_folder=template_dir) @app.route('/execute', methods=['POST'])