[Django]-How start server Django in the VM (Vagrant)

11👍

You have to forward the port from Vagrant to your local machine. You can add a line like this to your Vagrantfile:

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

And then run this in the Vagrant VM:

python manage.py runserver 0.0.0.0:8000

And on your host machine, go to http://localhost:8001 to view the webpage.

👤mipadi

0👍

Run python manage.py runserver 0:8000. It worked for me

0👍

  1. You have to forward the port from Vagrant to your local machine.

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

  2. Yo need to add IP to ALLOWED_HOST in your setting.py file

    0.0.0.0 to the ALLOWED_HOSTS in your settings.py

  3. Run Project

    python manage.py runserver 0.0.0.0:8000

Leave a comment