Skip to content

Commit e76408b

Browse files
committed
fix MANIFEST.in to include static/templates
1 parent 937da20 commit e76408b

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

MANIFEST.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
include src/django_idom/static/js/idom.js
2-
include src/django_idom/templates/head_content.html
3-
include src/django_idom/templates/view.html
1+
recursive-include src/django_idom/static/ *
2+
recursive-include src/django_idom/templates/ *.html

noxfile.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ def test_suite(session: Session) -> None:
5151

5252
session.chdir(HERE / "tests")
5353
session.env["IDOM_DEBUG_MODE"] = "1"
54-
session.env["SELENIUM_HEADLESS"] = str(int("--headless" in session.posargs))
55-
session.run("python", "manage.py", "test")
54+
55+
posargs = session.posargs[:]
56+
if "--headless" in posargs:
57+
posargs.remove("--headless")
58+
session.env["SELENIUM_HEADLESS"] = "1"
59+
60+
if "--no-debug-mode" not in posargs:
61+
posargs.append("--debug-mode")
62+
63+
session.run("python", "manage.py", "test", *posargs)
5664

5765

5866
@nox.session

src/django_idom/app_settings.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
from pathlib import Path
2+
13
from django.conf import settings
24

5+
APP_DIR = Path(__file__).parent
6+
7+
TEMPLATE_FILE_PATHS = {
8+
file.stem: str(file.absolute())
9+
for file in (APP_DIR / "templates" / "idom").iterdir()
10+
}
311

412
IDOM_WEBSOCKET_URL = getattr(settings, "IDOM_WEBSOCKET_URL", "_idom/")
513
if not IDOM_WEBSOCKET_URL.endswith("/"):

src/django_idom/templatetags/idom.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
from django import template
44

5-
from django_idom.app_settings import IDOM_WEBSOCKET_URL
5+
from django_idom.app_settings import IDOM_WEBSOCKET_URL, TEMPLATE_FILE_PATHS
66

77

88
register = template.Library()
99

1010

1111
# Template tag that renders the IDOM scripts
12-
@register.inclusion_tag("idom/head_content.html")
12+
@register.inclusion_tag(TEMPLATE_FILE_PATHS["head_content"])
1313
def idom_head():
1414
pass
1515

1616

17-
@register.inclusion_tag("idom/view.html")
17+
@register.inclusion_tag(TEMPLATE_FILE_PATHS["view"])
1818
def idom_view(view_id, view_params=""):
1919
return {
2020
"idom_websocket_url": IDOM_WEBSOCKET_URL,

0 commit comments

Comments
 (0)