我试图运行一个项目,该项目在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在上面运行。
答案 0 :(得分:1)
看起来您的web2py客户端页面在端口8080上提供,但随后向端口8075发出Ajax请求,这违反了Web浏览器强制执行的same origin policy。