【问题标题】:Django Static folder access issueDjango静态文件夹访问问题
【发布时间】:2013-11-22 23:28:04
【问题描述】:

我想访问静态文件夹中的图像 图片名称是动态的。

我正在使用这种语法:

"{% static 'theme/one page base/bgimages/"+num+".jpg' %}"

其中 num 是在运行时使用 javascript 计算的随机数。 但它不起作用

【问题讨论】:

标签: django django-templates django-staticfiles


【解决方案1】:

通过使用这个语法,它可以工作:

"{% static 'theme/one page base/bgimages/' %}/"+num+".jpg"

【讨论】:

    猜你喜欢
    • 2011-06-11
    • 2017-12-23
    • 1970-01-01
    • 1970-01-01
    • 2021-05-20
    • 2021-08-14
    • 1970-01-01
    • 2021-06-21
    • 2020-11-06
    相关资源
    最近更新 更多