| 1 |
from pathlib import Path |
| 2 |
|
| 3 |
from litestar import Litestar, get |
| 4 |
from litestar.plugins.jinja import JinjaTemplateEngine |
| 5 |
from litestar.response import Template |
| 6 |
from litestar.template.config import TemplateConfig |
| 7 |
|
| 8 |
|
| 9 |
@get("/uploads") |
| 10 |
async def get_uploads() -> Template: |
| 11 |
return Template( |
| 12 |
template_str="<p>debug={{ debug }}</p>", |
| 13 |
context={"debug": True}, |
| 14 |
) |
| 15 |
|
| 16 |
|
| 17 |
app = Litestar( |
| 18 |
route_handlers=[get_uploads], |
| 19 |
template_config=TemplateConfig( |
| 20 |
directory=Path(__file__).parent, |
| 21 |
engine=JinjaTemplateEngine, |
| 22 |
), |
| 23 |
) |