Skip to content

Commit 52b1de0

Browse files
ISSUE #89
1 parent 3276904 commit 52b1de0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

minos/api_gateway/rest/service.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ async def create_application(self) -> web.Application:
7171
app.router.add_route("DELETE", "/admin/rules/{id}", AdminHandler.delete_rule)
7272

7373
# Administration routes
74-
path = Path(Path.cwd())
75-
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader(f"{path}/minos/api_gateway/rest/backend/templates"))
74+
path = Path(__file__).parent
75+
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader(f"{path}/backend/templates"))
7676
app.router.add_route("*", "/administration{path:.*}", self.handler)
7777
# app.router.add_route("GET", "/administration/{filename:.*}", self._serve_files)
7878

@@ -94,10 +94,9 @@ async def create_database(self):
9494
@aiohttp_jinja2.template("tmpl.jinja2")
9595
async def handler(self, request):
9696
try:
97-
path = Path(Path.cwd())
98-
self._directory = path.resolve()
97+
path = Path(__file__).parent
9998
filename = Path(request.match_info["path"].replace("/", "", 1))
100-
filepath = self._directory.joinpath("minos", "api_gateway", "rest", "backend", "admin", filename).resolve()
99+
filepath = path.joinpath("backend", "admin", filename).resolve()
101100

102101
if filepath.is_file():
103102
return await self._get_file(filepath)

0 commit comments

Comments
 (0)