带有Google App Engine App的AccessControlAllowOrigin不允许Origin null

2024-06-16 13:06:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我的网站上有一个指向我的域名的应用程序。app spot应用程序正在运行一个非常简单的python脚本,如下所示:

import cgi,webapp2


class ProblemRedirect(webapp2.RequestHandler):

    def post(self):
        print(cgi.escape(self.request.get('problem_text')))
        print(cgi.escape(self.request.get('student_name')))
        print(cgi.escape(self.request.get('student_email')))



application = webapp2.WSGIApplication([
    ('/', ProblemRedirect),
], debug=True)

以下是我的表单的HTML:

^{pr2}$

此表单位于另一个web服务器上,但由appspot脚本处理。但是,每当我提交表格时,都会出现错误:

XMLHttpRequest cannot load http://www.summit-tech-help.appspot.com/. Origin null is not allowed by Access-Control-Allow-Origin. 

我做错什么了吗?另外,我在OSX上部署了googleappengine启动器中的应用程序。当我点击启动程序上的“运行”时,它就运行了本地主机:8080,那么当它工作时我能看到“打印”吗?谢谢!在

~地毯泡沫


Tags: self脚本应用程序get网站requestoriginstudent