问题的Apache2使用(mod_wsgi的),系统有时是&QUOT Django的;无法从模块&QUOT进口;没有明显的原因 [英] Problem with Django using Apache2 (mod_wsgi), Occassionally is "unable to import from module" for no apparent reason

查看:160
本文介绍了问题的Apache2使用(mod_wsgi的),系统有时是&QUOT Django的;无法从模块&QUOT进口;没有明显的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经把我的Django的网站多达我的Web服务器,并将它设置使用的Apache2和mod_wsgi的..一切工作正常的大部分时间,但偶尔会只是给它不能导入模块错误(通常是从我的观点文件)。但是,这不是与模块的问题,因为它通常工作,比如,我会得到错误无法导入的类名的从模块一次,然后重新加载该页面,它工作得很好,我会说它在10页面加载约1哪里发生这种情况,它只是随机,因为它会发生在我的网站的任何页面。

I have put my Django web site up to my web server and have it set up using apache2 and mod_wsgi.. everything works fine most of the time but occasionally it will just give the error that it can't import a module (usually from my views file). However, it's not an issue with that module as it usually works, for example, I will get the error "Cannot import classname from module" once, then reload the page and it works fine, I would say it's about 1 in 10 page loads where this occurs and it's just random as it will happen for any page on my site.

我曾尝试重新启动的Apache2,重新启动服务器,但问题仍然存在。我已经尝试过不同的客户端机器,清理出用户缓存等,但问题仍然存在。我不知道什么可能也许这样做,将某种缓存帮助prevent的这个,因为它似乎在服务器只是具有有时候不能够完全处理请求的问题。我使用的是云中的服务器上设置了不多的内存,所以也许这是什么问题?任何意见是AP preciated

I have tried restarting apache2, restarting the server but the issue persists. I have tried it on different client machines, clearing out the user cache, etc but the issue persists. I don't know what might be doing this, would perhaps some sort of caching help prevent this as it seems that the server is just having an issue with sometimes not being able to fully process the request. I am using a cloud set up with not much memory on the server so maybe this is the problem? Any advice is appreciated

推荐答案

有正在工作的大部分时间,因为你可能有一个多处理结构和只的处理中的一个的影响。

It is working most of the time because you likely have a multi process configuration and only one of the processes is affected.

您可以尝试备用WSGI脚本文件中记录:

You can try alternate WSGI script file as documented in:

的http://博客。 dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

陪审团还在外面来的问题是否是使用WSGI开发服务器和正确部署系统之间的差异,抑或是用户不处理正确的进口,造成订单的依赖,甚至进口周期。问题可能只拿出当URL访问了一定的顺序,因此为什么随机何时可能发生了。

The jury is still out as to whether the issue is the differences between development server and proper deployment systems using WSGI, or whether it is users not handling imports properly and causing order dependencies or even import cycles. Problems possibly only come up when URL visited in certain order and thus why random as to when it can happen.

这篇关于问题的Apache2使用(mod_wsgi的),系统有时是&QUOT Django的;无法从模块&QUOT进口;没有明显的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆