Setting up Django on a clean VM: issue linking runserver to VM's ip

33 views
Skip to first unread message

Samuel Muiruri

unread,
Jan 22, 2018, 9:06:59 AM1/22/18
to Google Cloud Developers

I'm setting up my Django site on a clean Ubuntu VM. Gone through the process of installing the necessary tools, I follow this tutorial and apart from the additional python packages I've added for my site it's the same process.

According to this instructional guide to check whether everything is running smoothly you run python manage.py runserver 0.0.0.0:8000 and it should then run on the IP:8000 of the site.


enter image description here


above is the instance of this running


enter image description here

and this above shows the external ip of the google cloud instance running this.

However when i try to visit http://35.227.49.155:8000/ I get This site can't be reached and it's double confirmed with no activity on the shell on a request picked up.


It was also suggested that likely google cloud's firewall might be blocking this I've tried made this port open


enter image description here


but still can't get it to work.

Carlos (Cloud Platform Support)

unread,
Jan 22, 2018, 3:08:21 PM1/22/18
to google-c...@googlegroups.com
As per your screenshots the firewall rule in Google Network will work as long as your instance has the tag “pluscolor” and the request is coming from the source IP address 35.227.49.155.Therefore you will only be able to reach the server if the request is coming from itself. Other incoming traffic to the network on port 8000 will be filtered.

If you want to reach the server from anywhere on the Internet you can remove the “Source Filters” (or use 0.0.0.0/0). Make also sure that your server is using the tag “pluscolor”, otherwise the rule will not apply. If you also remove the “Target tags” in the firewall, traffic will be allowed to all VMs in that network on tcp port 8000. 

For more information on how source filters and target tags work you can visit this article.
Reply all
Reply to author
Forward
0 new messages