From: Michael Tremer Date: Sat, 7 Oct 2017 11:38:59 +0000 (+0100) Subject: Load templates and static files from the right locations X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=027a662e2f4c533be6f3968570290f7a8df59603;p=pbs.git Load templates and static files from the right locations Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index b19f3352..a958b9b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -457,7 +457,9 @@ substitutions = \ '|configsdir=$(configsdir)|' \ '|bindir=$(bindir)|' \ '|datadir=$(datadir)|' \ - '|localedir=$(localedir)|' + '|localedir=$(localedir)|' \ + '|templatesdir=$(templatesdir)|' \ + '|staticdir=$(staticdir)|' SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \ diff --git a/src/buildservice/constants.py.in b/src/buildservice/constants.py.in index 7d20ab23..7bfc73e1 100644 --- a/src/buildservice/constants.py.in +++ b/src/buildservice/constants.py.in @@ -7,9 +7,11 @@ from pakfire.constants import * PACKAGE_NAME = "@PACKAGE_NAME@" -CONFIGSDIR = "@configsdir@" -DATADIR = "@datadir@" -LOCALEDIR = "@localedir@" +CONFIGSDIR = "@configsdir@" +DATADIR = "@datadir@" +LOCALEDIR = "@localedir@" +TEMPLATESDIR = "@templatesdir@" +STATICDIR = "@staticdir@" PAKFIRE_DIR = "/pakfire" PACKAGES_DIR = os.path.join(PAKFIRE_DIR, "packages") diff --git a/src/hub/__init__.py b/src/hub/__init__.py index 0b2e6247..fa25c61f 100644 --- a/src/hub/__init__.py +++ b/src/hub/__init__.py @@ -11,8 +11,6 @@ from .. import Backend from . import handlers -BASEDIR = os.path.join(os.path.dirname(__file__), "..", "data") - # Read command line tornado.options.define("debug", default=False, help="Run in debug mode", type=bool) tornado.options.parse_command_line() diff --git a/src/web/__init__.py b/src/web/__init__.py index 82f9fb3c..1ff96103 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -16,8 +16,6 @@ from . import handlers_api from .handlers import * from .ui_modules import * -BASEDIR = os.path.join(os.path.dirname(__file__), "..", "data") - # Enable logging tornado.options.define("debug", default=False, help="Run in debug mode", type=bool) tornado.options.parse_command_line() @@ -30,7 +28,8 @@ class Application(tornado.web.Application): debug = tornado.options.options.debug, gzip = True, login_url = "/login", - template_path = os.path.join(BASEDIR, "templates"), + template_path = TEMPLATESDIR, + static_path = STATICDIR, ui_modules = { "Text" : TextModule, "Modal" : ModalModule, @@ -102,7 +101,7 @@ class Application(tornado.web.Application): tornado.web.Application.__init__(self, **settings) - self.settings["static_path"] = static_path = os.path.join(BASEDIR, "static") + self.settings["static_path"] = static_path = STATICDIR static_handlers = [ (r"/static/(.*)", tornado.web.StaticFileHandler, dict(path = static_path)), (r"/(favicon\.ico)", tornado.web.StaticFileHandler, dict(path = static_path)),