diff --git a/requirements.txt b/requirements.txt index 6c5df4b9..36799a50 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ -ruff black +jinja2 pytest pytest-django +ruff uwsgi diff --git a/src/lando/jinja2.py b/src/lando/jinja2.py new file mode 100644 index 00000000..e979ea55 --- /dev/null +++ b/src/lando/jinja2.py @@ -0,0 +1,15 @@ +from django.templatetags.static import static +from django.urls import reverse + +from jinja2 import Environment + + +def environment(**options): + env = Environment(**options) + env.globals.update( + { + "static": static, + "url": reverse, + } + ) + return env diff --git a/src/lando/settings.py b/src/lando/settings.py index 55d02071..b761c596 100644 --- a/src/lando/settings.py +++ b/src/lando/settings.py @@ -54,6 +54,14 @@ ROOT_URLCONF = "lando.urls" TEMPLATES = [ + { + "BACKEND": "django.template.backends.jinja2.Jinja2", + "DIRS": [], + "APP_DIRS": True, + "OPTIONS": { + "environment": "lando.jinja2.environment" + }, + }, { "BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": [],