djc / askama

Type-safe, compiled Jinja-like templates for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HELP: about askama_axum::Template

SnailFighter opened this issue · comments

commented

Hello everyone,
I am trying the axum and the askama to deveop a web app frist, and I code as the example, but it still reports error.
What should i do?
Here is the cargo code :
`[package]
name = "axum_hello"
version = "0.1.0"
edition = "2021"

[dependencies]
axum="0.7.5"
tokio={version="1.37.0",features=["macros","rt-multi-thread"]}
askama_axum="0.4.0"`

Rust Code:

`use askama_axum::Template;

#[derive(Template)]
#[template(path="me.html")]
struct Person<'a> {
name: &'a str,
}`

企业微信截图_17144746598923

Unfortunately the published book is based on the main branch, and the integrations on main work differently from released versions. So you'll need to add askama directly in your Cargo.toml.

We should really handle that differently, it's really problematic that only the main branch book version is published.