简体   繁体   English

django devserver无法连接

[英]django devserver can't connect

I have a situation where if I run Apache with wsgi (now uninstalled), a test website works, but running the same server with runserver 0.0.0.0:8080 gives ERR_CONNECTION_REFUSED from local or remote (even with the apache2 service stopped). 我遇到的一种情况是,如果我在wsgi上运行Apache(现在已卸载),则可以运行一个测试网站,但是在运行服务器0.0.0.0:8080上运行同一台服务器,则会从本地或远程提供ERR_CONNECTION_REFUSED(即使apache2服务已停止)。

Edit: I don't think it's Apache, I've reproduced the problem on a clean server with no Apache installed, so unless Apache somehow modified something under source control it's not that 编辑:我不认为它是Apache,我已经在没有安装Apache的干净服务器上重现了该问题,因此除非Apache以某种方式在源代码控制下修改了某些内容,否则并非如此

My knowledge of web details is hazy, I don't even know where to troubleshoot this problem - the devserver runs (runserver prints as expected and doesn't give any errors) but never receives a request, I have nothing in iptables. 我对Web详细信息的了解很模糊,我什至不知道在哪里解决此问题-devserver运行(runserver按预期方式打印,并且不给出任何错误),但从未收到请求,iptables中没有任何内容。

Sorry for anyone who read this, it would probably have been impossible to solve given my supplied information. 对不起,阅读本手册的任何人,鉴于我提供的信息,可能无法解决。

What had actually happened was that I'd been having to modify my wsgi.py script in order to make it happy inside the Apache server, and I'd added a line which said "os.system('/bin/bash --rcfile )" to try and make sure that when running inside apache it got the virtualenv activated. 实际发生的是,我不得不修改wsgi.py脚本才能使其在Apache服务器中满意,并且我添加了一行,写上“ os.system('/ bin / bash- rcfile)”以尝试确保在apache中运行时已激活virtualenv。

This line must have been causing some strange problem, another symptom was that I realised when I was running "runserver", it wasn't crashing the the python process was backgrounding itself, where normally it runs inside that console window. 这行肯定已经引起了一些奇怪的问题,另一个症状是我意识到当我运行“ runserver”时,它并没有崩溃,而python进程本身已经在后台运行了,通常它在控制台窗口中运行。

Thanks everyone who asked questions helping me debug! 感谢所有提出帮助我进行调试的问题!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM