[英]Django runserver not working from google cloud platform
This question is very similar to (but is not the same because I am running on the google cloud, which I suspect may be cause of the issue): 这个问题非常相似(但是不一样,因为我在google cloud上运行,我怀疑可能是这个问题的原因):
I am trying to set up an api running on a VM-instance on the google cloud platform. 我正在尝试在Google云平台上的VM实例上运行运行的api。 So far I got nginx working (when I go to the ip address it greats me with a welcome message).
到目前为止,我已经使nginx正常工作(当我转到ip地址时,会收到一条欢迎消息,这对我很有帮助)。 When I run:
当我跑步时:
python3 manage.py runserver 0.0.0.0:8000
I get the following output: 我得到以下输出:
Performing system checks...
正在执行系统检查...
System check identified no issues (0 silenced).
系统检查未发现任何问题(0静音)。
February 06, 2019 - 09:27:13
二月06,2019-09:27:13
Django version 2.1.5, using settings 'my_api.settings.development'
Django版本2.1.5,使用设置“ my_api.settings.development”
Starting development server at http://0.0.0.0:8000/
在http://0.0.0.0:8000/上启动开发服务器
Quit the server with CONTROL-C.
用CONTROL-C退出服务器。
Which seems good, but when I go to any of the following pages (all of which I've listed under allowed_hosts): 看起来不错,但是当我转到以下任何页面时(所有这些页面我都列在allowed_hosts下):
The page won't load. 该页面将无法加载。
I´ve tried checking which ports are used using 我尝试检查使用了哪些端口
netstat
And I've killed all programs using this port after which I restarted my program, but to no avail. 并且我已经杀死了使用此端口的所有程序,然后重新启动程序,但无济于事。
At this point, I've fixed everything suggested in other posts and I'm out of ideas. 在这一点上,我已经修复了其他帖子中建议的所有内容,但我没有想法。 What would be the next step in finding/solving the cause of my internet page not loading?
查找/解决我的网页无法加载的原因的下一步是什么?
You will need to create a firewall rule to allow inbound traffic on tcp port 8000
. 您将需要创建防火墙规则以允许
tcp port 8000
上的入站流量。
When creating the firewall rule, also specify a Target tag
so that you can assign the firewall rule to the instance. 创建防火墙规则时,还请指定
Target tag
以便您可以将防火墙规则分配给实例。 Another option is to specify a service account such as Compute Engine default service account
to assign the rule based upon identity. 另一个选项是指定服务帐户(例如
Compute Engine default service account
以根据身份分配规则。
As @JohnHanley points out, I needed to create a firewall rule. 正如@JohnHanley指出的那样,我需要创建一个防火墙规则。
I did this by: 我这样做是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.