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.
我将Django web站点放在我的web服务器上,并使用apache2和mod_wsgi设置它。大多数情况下,一切都很正常,但偶尔也会出错,因为它不能导入模块(通常来自我的视图文件)。然而,这不是一个问题,模块,因为它通常是有效的,例如,我会错误“无法从模块导入名称”一次,然后重新加载页面,效果很好,我会说它是大约10页面加载中发生这种情况,这只是随机的,因为它会发生任何对我的网站页面。
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
我尝试重新启动apache2,重新启动服务器,但问题仍然存在。我在不同的客户端机器上尝试过,清除用户缓存等等,但是问题仍然存在。我不知道这是怎么回事,也许某种缓存可以防止这种情况发生,因为服务器似乎有问题,有时无法完全处理请求。我正在使用服务器上内存不多的云设置,所以这可能是问题所在?任何建议都是赞赏
1 个解决方案
#1
1
It is working most of the time because you likely have a multi process configuration and only one of the processes is affected.
它大部分时间都在工作,因为您可能有一个多进程配置,并且只有一个进程受到影响。
You can try alternate WSGI script file as documented in:
您可以尝试替换WSGI脚本文件,如:
http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
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.
至于问题是开发服务器与使用WSGI的适当部署系统之间的差异,还是用户没有正确地处理导入、导致订单依赖甚至导入周期,目前还没有定论。问题可能只会在URL按一定顺序访问时出现,因此为什么会随机出现。
#1
1
It is working most of the time because you likely have a multi process configuration and only one of the processes is affected.
它大部分时间都在工作,因为您可能有一个多进程配置,并且只有一个进程受到影响。
You can try alternate WSGI script file as documented in:
您可以尝试替换WSGI脚本文件,如:
http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html
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.
至于问题是开发服务器与使用WSGI的适当部署系统之间的差异,还是用户没有正确地处理导入、导致订单依赖甚至导入周期,目前还没有定论。问题可能只会在URL按一定顺序访问时出现,因此为什么会随机出现。