【发布时间】:2018-09-24 03:47:02
【问题描述】:
在瓶子模板文件中,引用静态文件的方法是什么?比如这个?
<body background='/static/img/digital.gif'>
为什么上面的相关文件加载图片失败? 我怎样才能正确引用它?如果我尝试如下:
<body background="{{ static_file( 'digital.gif', root='./static/img' }}">
图像也无法渲染。
为什么即使不使用'static_file'函数,Bottle 也无法渲染图像?
【问题讨论】:
-
Guys in Bottle 我如何引用静态文件?
我的图片使用 './static/img' -
我的 DocumentRoot 是 '/home/nikos/public_html' 为什么连我都看不到 superhost.gr/static/img/digital.gif 的图像?图片位于“/home/nikos/public_html/static/img/”文件夹中
-
您绝对应该阅读整个 Bottle 教程。 bottlepy.org/docs/dev/tutorial.html#routing-static-files
-
我已阅读此部分,但我无法通过 url 访问静态图像,也无法使用 static_file 函数。你能帮忙吗?