A more clever way to get the static dirs

This commit is contained in:
Fabio Manganiello 2018-01-29 15:08:25 +01:00
parent 6ff1552063
commit 6ad7f85e76
1 changed files with 4 additions and 2 deletions

View File

@ -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'])