简体   繁体   English

当我尝试使用 corsheaders 时,为什么我的应用程序会中断?

[英]Why does my application break when I try to use corsheaders?

I have a client with a django web application which pulls information from a different web application and displays it on a web page.我有一个带有 django Web 应用程序的客户端,它从不同的 Web 应用程序中提取信息并将其显示在网页上。

The web application suddenly stopped working and the following message appeared in the server's supervisorctl: Web 应用程序突然停止工作,服务器的 supervisorctl 中出现以下消息:

https://imgur.com/oKz6rTJ https://imgur.com/oKz6rTJ

I didn't have much time, so I traced the error to the CorsHeaders middleware and commented it out from the website's settings.py while I work on a long term solution.我没有太多时间,所以我将错误追溯到 CorsHeaders 中间件,并在我研究长期解决方案时从网站的 settings.py 中将其注释掉。 To save people time researching, Cors is a middleware which allows web browsers to access your server even if it is in a different domain than the web page.为了节省人们的研究时间,Cors 是一个中间件,它允许 Web 浏览器访问您的服务器,即使它与网页位于不同的域中。 (aka what the client uses to upload their data from one webapp to another) (也就是客户端用来将数据从一个 webapp 上传到另一个 webapp 的内容)

This image outlines what I commented out: https://imgur.com/a/tEBiYGU这张图片概述了我注释掉的内容: https : //imgur.com/a/tEBiYGU

As mentioned, commenting out that middleware prevented it from loading any new data but the current graphs had no issues being displayed.如前所述,注释掉中间件阻止它加载任何新数据,但当前图表没有显示问题。 This confirmed my suspicion that corsheaders was the sole problem.这证实了我的怀疑,即 corsheaders 是唯一的问题。

Now I had a bit more time to research the issue at home and realized that the crux of the issue is the fact that the middleware is what calls on the apps import:现在我有更多的时间在家里研究这个问题,并意识到问题的关键在于中间件是调用应用程序导入的事实:

https://imgur.com/a/0812jFJ https://imgur.com/a/0812jFJ

Now I will admit that while I have some python experience, I have no experience with Django and I have no idea how its apps work or what that import is doing.现在我承认,虽然我有一些 Python 经验,但我没有使用 Django 的经验,我不知道它的应用程序是如何工作的,也不知道导入在做什么。 I ran我跑了

find /path/to/django/ -name "apps"

and also,并且,

find /path/to/django/ -name "apps.py"

and I got 0 hits.我得到了 0 次点击。 I'm not even sure that this django.apps exists in Django 1.3.1 which is what this client is running along with python 2.6.6我什至不确定这个 django.apps 是否存在于 Django 1.3.1 中,这是这个客户端与 python 2.6.6 一起运行的

I have already considered an upgrade but there are loads of other applications running on the server that a python or django upgrade is out of the question.我已经考虑过升级,但是服务器上运行着大量其他应用程序,python 或 django 升级是不可能的。 Is there any way to resolve this?有没有办法解决这个问题?

No resolution found and the server is being decommissioned.未找到解决方案,服务器正在停用。 Good riddance :)甩掉包袱 :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我尝试存储和使用实例(委托)而不是创建子类(继承)时,为什么库 class 会中断? - Why does a library class break when I try to store and use an instance (delegation) instead of making a subclass (inheritance)? 当我在if语句中尝试使用列表索引时,为什么会失败? - When I try to use list indexing in my if statement, why does it fail? 为什么我的查询在参数化时会中断? - Why does my query break when it is parameterized? 当我尝试设置中断时,为什么pdb显示“***空白或注释”? - Why is pdb displaying “*** Blank or comment” when I try to set a Break? 当我将其与Python 3 mod_wsgi应用程序一起使用时,为什么粘贴ErrorMiddleware会引发异常? - Why does Paste ErrorMiddleware throw an exception when I use it with my Python 3 mod_wsgi application? OSError:当我尝试在 Heroku 上部署我的 Flask 应用程序时,SavedModel 文件不存在 - OSError: SavedModel file does not exist when I try to deploy my Flask application on Heroku 尝试进行API调用时,为什么我的python脚本停止执行? - Why does my python script stop executing when I try to make my API call? 当我尝试运行我的烧瓶/python 应用程序时,它给了我错误:A secret key is required to use CSRF - when I try to run my flask/python application it gives me the error: A secret key is required to use CSRF 当我尝试在我的服务器上使用它时,为什么不会将命令发送到我的 DM - Why will the command not be sent to my DMs when I try and use it on my server 为什么在尝试加载数据时QlikView始终崩溃? - Why does QlikView keep crashing when I try to load my data?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM