找到你要的答案

Q:python, django, vagrant and access error on windows host machine

Q:Python,Django,流浪和访问Windows主机错误

Well, I'm trying to access a python server (for django development) in a Virtual Box VM via vagrant, but I can't connect with it in my windows browsers. I'll try to describe all the things I've done to make this work, so maybe it can help you guys.

My configurations:

  1. I set my vagrant file to allow connections in port 8000 (guest and host)
  2. I have disabled my windows firewall.
  3. I have turned off the firewall on the VM
  4. I have disabled all chrome extensions (including addblock)
  5. I have disabled almost all apps in my windows to minimize the chances that some program could use port 8000
  6. I have unchecked "automatically detect settings" and "use a proxy server for your lan" in the lan settings (windows internet options), then done the ip /release, ip /renew and rebooted my machine
  7. Yes, the python server is running well on the vm
  8. I tried the default 127.0.0.1:8000 (no success) and changed to 0.0.0.0:8000 using the command "python manage.py runserver 0.0.0.0:8000", but still ... :(
  9. I have a nginx server in the vm running well for my php apps in port 80, and i cant access them with no problems
  10. I use pycharm for python development and it starts my server normally in the vm either using 127.0.0.1:8000 or 0.0.0.0:8000

I think that's it, but the error persists, I can't access my python server in my ip 192.168.56.101 in port 8000, this ip is my private network on the vm that runs good with nginx.

But the result is always the same Whenever I try access http://192.168.56.101:8000/ all my browsers (IE, Firefox, Chrome) cannot complete the request, in Chrome the error is ERR_CONNECTION_TIMED_OUT

Thanks in advance for any help !

嗯,我试图访问服务器(Python的Django开发)通过流浪的虚拟盒子的VM,但我不能与它连接,在我的Windows浏览器。我会尽力描述我做这件事所做的一切,所以也许可以帮助你们。

我的配置:

  1. I set my vagrant file to allow connections in port 8000 (guest and host)
  2. I have disabled my windows firewall.
  3. I have turned off the firewall on the VM
  4. I have disabled all chrome extensions (including addblock)
  5. I have disabled almost all apps in my windows to minimize the chances that some program could use port 8000
  6. I have unchecked "automatically detect settings" and "use a proxy server for your lan" in the lan settings (windows internet options), then done the ip /release, ip /renew and rebooted my machine
  7. Yes, the python server is running well on the vm
  8. I tried the default 127.0.0.1:8000 (no success) and changed to 0.0.0.0:8000 using the command "python manage.py runserver 0.0.0.0:8000", but still ... :(
  9. I have a nginx server in the vm running well for my php apps in port 80, and i cant access them with no problems
  10. I use pycharm for python development and it starts my server normally in the vm either using 127.0.0.1:8000 or 0.0.0.0:8000

我认为这是它,但错误仍然存在,我无法访问我的Python的服务器在我的IP 192.168.56.101在端口8000,这个IP是我上运行良好,Nginx的VM专用网络。

But the result is always the same Whenever I try access http://192.168.56.101:8000/ all my browsers (IE, Firefox, Chrome) cannot complete the request, in Chrome the error is ERR_CONNECTION_TIMED_OUT

提前感谢任何帮助!

answer1: 回答1:

My problem was the firewall rules. I dont really need it since its a development environment, so I delete all the rules in /etc/iptables/rules.v4 and save the file. That solve it all. Tks.

我的问题是防火墙规则。我真的不需要它,因为它的开发环境,所以我删除了所有的规则在/ etc /防火墙/ rules.v4和保存文件。这解决了所有。谢谢。

python  django  google-chrome  vagrant