Hi guys, need some help.
I’ve installed Ubuntu 18.04 on a GCP VM. Installed Django and the ‘mysite app’ from Django. Then initiated the following command ‘python3 manage.py runserver’. I’m getting the error from below on a chrome browser.
I’ve already allowed all ingress traffic on the GCP firewall.
Any ideas why I can’t start manage.py from the mysite folder and view it on a browser?
Thanks in advance!
This site can’t be reached
127.0.0.1 refused to connect.
127.0.0.1 is the localhost address - it’s a reference to the machine on which the browser is running. It’s not the address of your GCP VM.
Additionally, I suggest you read the runserver documentation, especially the parts about not using runserver in a production environment.
Try to figure out your GCP VM ip address, let’s say it’s 192.138.12.01, then your Django server should be available at
Thanks both! Tried with the public IP and still doesn’t work. I’ve identified my GCP VM public IP address and used that with ‘http://’ as prefix and port :8000 as a suffix. Here it it: http://220.127.116.11:8000
I also tried to ‘runserver 80’ so that it runs on port 80.
I changed the firewall ingress to allow all TCP / HTTP traffic, and still doesn’t work.
I also checked for any firewall rules in the Ubuntu OS but they are already disabled.
Again, I suggest you read the runserver documentation, also referencing the section Listening on different addresses
If you receive the error message that port is already in use, tell Django to use a different port by entering python manage.py runserver 8001, and then cycle through higher numbers until you find an open port.