Vagrant is not forwarding when I run django runserver on ssh

前端 未结 2 1594
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-31 17:28

I created a Vagrant Ubuntu (lucid32) box with Python & Django. My idea is start the VM, log into it with vagrant ssh, and then start Django by running:

2条回答
  •  一生所求
    2021-01-31 17:38

    First, you need to do port forwarding in Vagrant file.

    config.vm.network "forwarded_port", guest: 8000, host: 8000
    

    Then you need to restart/reload your vangrant vm

    vagrant reload
    

    Now ssh to your vm and run django server as follows

    python manage.py runserver 0.0.0.0:8000
    

提交回复
热议问题