Local Django website won't load in browser

后端 未结 4 1213
终归单人心
终归单人心 2021-01-15 06:16

I\'m guessing there\'s a very simple solution to this, but I searched every forum and setup guide and can\'t figure it out:

I built a Django/CentOS-6.3 environment

4条回答
  •  暖寄归人
    2021-01-15 07:05

    If your network is configured correctly and your django application with

    python manage.py runserver 0.0.0.0:8000

    and you still can't access your django app from the VM host there is almost certainly a firewall issue. The solution above is good if you are running iptables.

    I deployed CentOS 7 on a virtualbox VM from a Windows 7 host. I didn't know that this distribution uses firewalld, not iptables to control access.

    if

    ps -ae | grep firewall

    returns something like

    602 ? 00:00:00 firewalld

    your system is running firewalld, not iptables. They do not run together.

    To correct you VM so you can access your django site from the host use the commands:

    firewall-cmd --zone=public --add-port=8000/tcp --permanent

    firewall-cmd --reload

    Many thanks to pablo v for pointing this out in the post "Access django server on virtual Machine".

提交回复
热议问题