小编use*_*814的帖子

在django中加载带有变量名的静态文件

我正在尝试加载以下静态文件

 <a href="{%static 'static/images/'{{ image.title }}'.png' %}">img file</a> 
Run Code Online (Sandbox Code Playgroud)

在从数据库派生image的for循环中的位置images.

但我只是犯了一个错误 Could not parse the remainder: '{{' from ''static/matrices/'{{'

我该怎么做才能解决这个问题?我不能使用相对路径,因为这也将由子部分使用,具有相同的html模板.

python django web-applications

7
推荐指数
4
解决办法
1万
查看次数

标签 统计

django ×1

python ×1

web-applications ×1