Skip to content

Commit 9ebde51

Browse files
author
Jeny Sadadia
committed
Move templates to api directory
In order to access templates while running API from python package, move `templates` to `api` directory. Update `pyproject.toml` to include `api/templates` directory to the python package. Update `api.user_manager` to use `PackageLoader` to load templates from the python package. Signed-off-by: Jeny Sadadia <[email protected]>
1 parent dcc5c94 commit 9ebde51

7 files changed

+3
-3
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

api/user_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, *args, **kwargs):
3030
super().__init__(*args, **kwargs)
3131
self._email_sender = None
3232
self._template_env = jinja2.Environment(
33-
loader=jinja2.FileSystemLoader("./templates/")
33+
loader=jinja2.PackageLoader("api", "templates")
3434
)
3535

3636
@property

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Documentation = "https://kernelci.org/docs"
5151
Repository = "https://github.com/kernelci/kernelci-api"
5252

5353
[tool.setuptools]
54-
packages = ["api", "scripts", "templates"]
54+
packages = ["api", "scripts", "api.templates"]
5555

5656
[tool.setuptools.package-data]
5757
scripts = ["*"]
58-
templates = ["*.jinja2", "*.html"]
58+
"api.templates" = ["*.jinja2", "*.html"]

0 commit comments

Comments
 (0)