Python Lighttpd web服务器未显示.png或.jpg图像

Python Lighttpd web服务器未显示.png或.jpg图像,python,html,raspberry-pi,lighttpd,Python,Html,Raspberry Pi,Lighttpd,我正在尝试在lighttpd Web服务器上创建一个基于.png图像的按钮 问题是,当我将我的Raspberry Pi IP地址放入地址栏时,图像不会显示。如果我直接从目录中打开index.html文件,图像就会显示出来 这对我来说意味着lighttpd需要某种形式的许可才能访问图像,但我不确定是否是这样,以及我将如何着手纠正这种情况 我的index.html代码如下所示,我已经检查了确切的文件位置,它们与代码匹配 <html> <head> <script lan

我正在尝试在lighttpd Web服务器上创建一个基于
.png
图像的按钮

问题是,当我将我的Raspberry Pi IP地址放入地址栏时,图像不会显示。如果我直接从目录中打开index.html文件,图像就会显示出来

这对我来说意味着lighttpd需要某种形式的许可才能访问图像,但我不确定是否是这样,以及我将如何着手纠正这种情况

我的index.html代码如下所示,我已经检查了确切的文件位置,它们与代码匹配

<html>
<head>
<script language="JavaScript">
var xmlhttp;
xmlhttp=new XMLHttpRequest();

function forward()
   {
       xmlhttp.open("GET","/var/www/html/forward.py", true);
       xmlhttp.send();
   }

</script>
</head>
<body>
<h1> Internet controlled robot vehicle </h1>
<img src="/var/www/html/forwardbutton.png" id="t" onmousedown="forward()">
</body>
</html>

var-xmlhttp;
xmlhttp=新的XMLHttpRequest();
函数forward()
{
open(“GET”,“/var/www/html/forward.py”,true);
xmlhttp.send();
}
网络控制机器人车
非常感谢

<img src="/var/www/html/forwardbutton.png" id="t" onmousedown="forward()">
要检查权限设置是否正确,可以直接在浏览器中打开图像。只需导航到URL:

http://<ip address of your Pi>/forwardbutton.png
http:///forwardbutton.png
您似乎正在尝试的XHR也是如此,尽管我不清楚您为什么要将Python脚本下载到浏览器中

http://<ip address of your Pi>/forwardbutton.png