Gunicorn – 无法访问Django项目(浏览器超时)

使用AWS和Gunicorn,我的Django站点是可访问和function齐全的,如果我启动Django的内置服务器,但我不能通过Gunicorn访问它。

如果我尝试:

gunicorn MyApp.wsgi

它似乎启动:

 [2015-11-18 17:53:30 +0000] [18752] [INFO] Starting gunicorn 19.3.0 [2015-11-18 17:53:30 +0000] [18752] [INFO] Listening at: http://0.0.0.0:8001 (18752) [2015-11-18 17:53:30 +0000] [18752] [INFO] Using worker: sync [2015-11-18 17:53:30 +0000] [18755] [INFO] Booting worker with pid: 18755 

但浏览器只是返回基本URL / IP地址的Nginx启动页面,并在尝试访问<url>:8001<ip_address>:8001时超时。

我运行时得到了相同的结果:

gunicorn MyApp.wsgi:application --bind 0.0.0.0:8001

编辑:如果我尝试使用特定的URL代替0.0.0.0相同的命令它会输出以下内容:

 [2015-11-18 18:24:17 +0000] [18902] [INFO] Starting gunicorn 19.3.0 [2015-11-18 18:24:17 +0000] [18902] [ERROR] Retrying in 1 second. [2015-11-18 18:24:18 +0000] [18902] [ERROR] Retrying in 1 second. [2015-11-18 18:24:19 +0000] [18902] [ERROR] Retrying in 1 second. [2015-11-18 18:24:20 +0000] [18902] [ERROR] Retrying in 1 second. [2015-11-18 18:24:21 +0000] [18902] [ERROR] Retrying in 1 second. [2015-11-18 18:24:22 +0000] [18902] [ERROR] Can't connect to ('myurl.xyz', 8001) 

如果我使用服务器的IP地址,我会看到:

 [2015-11-18 18:26:22 +0000] [18911] [INFO] Starting gunicorn 19.3.0 [2015-11-18 18:26:22 +0000] [18911] [ERROR] Invalid address: ('<my_ip>', 8001) 

我花了3天没有成功地试图让uWSGI工作,而且我在第二天和Gunicorn一起工作,我似乎也无法通过这一点。 没有文档或教程指定如果第一步不起作用该怎么做。 我对此很新,也许有一些简单的东西,我忽视了其他人只是假定会被照顾?

在Django设置模块的ALLOWED_HOSTS部分,所有相关的IP地址和URL都被正确设置。

正如丹尼尔·罗斯曼(Daniel Roseman)指出的那样,亚马逊似乎并没有允许我在没有额外配置的情况下做我想要做的事情。

我接受了建议,配置了Nginx,现在我可以使用了

gunicorn MyApp.wsgi:application --bind=172.31.21.65:8000

旋转起来。