我试图在我的网站上使用processing.js,但我一直收到错误:" processing.min.js无法加载资源:服务器响应状态为404(未找到)"
我使用Flask的 render_template()加载test.html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Processing.js</title>
<script src="processing.min.js"></script>
</head>
<body>
<h1>Processing.js</h1>
<script type="text/processing">
void setup() {
size(400,200);
textAlign(CENTER, CENTER);
background(0,0,100);
fill(255,230,75);
text("Processing.js", width/2, height/2);
noLoop();
}
void draw() {
}
void mouseMoved() {
stroke(255);
point(mouseX, mouseY);
redraw();
}
void mousePressed() {
line(0,mouseY,width,mouseY);
line(mouseX,0,mouseX,height);
println(mouseX, mouseY);
}
</script>
<canvas></canvas>
</body>
</html>
我随后运行的烧瓶文件只是:
from flask import Flask,request,render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('test.html')
if __name__ == '__main__':
app.debug = True
app.run()
当我在本地主机上运行时: http://127.0.0.1:5000/ 我看到标题 Processing.js 但没有实际的canvas元素。
答案 0 :(得分:0)