我一直在关注教程https://devcenter.heroku.com/articles/django#declare-process-types-with-procfile https://devcenter.heroku.com/articles/django#declare-process-types-with-procfile。
除了一件让我困扰的事情外,一切都很顺利。
启动 foreman 后,我应该看到以下内容:
$ foreman start
2013-04-03 16:11:22 [8469] [INFO] Starting gunicorn 0.17.2
2013-04-03 16:11:22 [8469] [INFO] Listening at: http://127.0.0.1:8000 (8469)
但是,我得到:
Starting gunicorn 17.5
Listening at: http://0.0.0.0:5000
如何更改它以便它只侦听我的本地计算机(即 127.0.0.1)?
我的 Procfile 仅包含
web: gunicorn hellodjango.wsgi
thanks!
这看起来是您运行 use Gunicorn 来为 foreman 提供 WSGI 应用程序时使用的默认 IP 地址。
在没有 foreman 的情况下运行 django 应用程序,如下所示:
gunicorn hellodjango.wsgi:application
将其绑定到gunicorn的默认值,127.0.0.1:8000
2013-08-23 00:02:54 [45352] [INFO] Starting gunicorn 17.5
2013-08-23 00:02:54 [45352] [INFO] Listening at: http://127.0.0.1:8000 (45352)
2013-08-23 00:02:54 [45352] [INFO] Using worker: sync
2013-08-23 00:02:54 [45355] [INFO] Booting worker with pid: 45355
并在你的指定Procfile
使用哪个绑定:
web: gunicorn -b 127.0.0.1:8000 hellodjango.wsgi
将其绑定到127.0.0.1:8000
,或您指定的任何内容。
00:06:26 web.1 | started with pid 45384
00:06:26 web.1 | 2013-08-23 00:06:26 [45384] [INFO] Starting gunicorn 17.5
00:06:26 web.1 | 2013-08-23 00:06:26 [45384] [INFO] Listening at: http://127.0.0.1:8000 (45384)
00:06:26 web.1 | 2013-08-23 00:06:26 [45384] [INFO] Using worker: sync
00:06:26 web.1 | 2013-08-23 00:06:26 [45387] [INFO] Booting worker with pid: 45387
我有兴趣确切地找到工头告诉gunicorn使用的地方0.0.0.0
作为默认值。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)