Web2py客户端服务器无法正常工作

时间:2014-04-29 08:52:59

标签: python web2py

我试图运行一个项目,该项目在web2py服务器和基于web2py的客户端中保存数据,显示可视化。在运行服务器和客户端时,clinet端的chrome控制台显示:

XMLHttpRequest cannot load http://127.0.0.1:8075/?format=json. 
No 'Access-Control-     Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1:8080' is therefore not allowed access. (index):1
[ERROR] Cannot connect to data server:  http://127.0.0.1:8075?format=json 

我在linux上使用web2py2.9.5在上面运行。

1 个答案:

答案 0 :(得分:1)

看起来您的web2py客户端页面在端口8080上提供,但随后向端口8075发出Ajax请求,这违反了Web浏览器强制执行的same origin policy

如果您无法同时使用同一来源,则可以使用JSONP或设置CORS来解决此问题。