【发布时间】:2019-12-24 21:50:48
【问题描述】:
我有一个在 Heroku 上运行良好的 Django 应用程序。此时,我想启动第二个进程,该进程实现一个守护进程,该进程与其他设备交换数据并填充 Django 应用程序的数据库。
我将第二个守护进程实现为 Django 应用程序的自定义命令,所以在我的 Procfile 中有
web: gunicorn portal.wsgi --log-file -
listener: python manage.py listen_to_devices
此时我使用heroku ps:scale listener=1 启动守护进程。
设备无法连接。在调试时,我注意到我的应用在 DNS 中有几个条目,我猜是为了负载平衡:
ottavio@debian:~$ nslookup xxx.herokuapp.com
Server: 192.168.69.2
Address: 192.168.69.2#53
Non-authoritative answer:
Name: xxx.herokuapp.com
Address: 52.51.85.80
Name: xxx.herokuapp.com
Address: 52.212.106.249
Name: xxx.herokuapp.com
Address: 54.171.30.127
Name: xxx.herokuapp.com
Address: 54.171.254.93
Name: xxx.herokuapp.com
Address: 54.194.235.52
Name: xxx.herokuapp.com
Address: 99.80.174.196
Name: xxx.herokuapp.com
Address: 52.18.173.71
Name: xxx.herokuapp.com
Address: 52.48.204.199
ottavio@debian:~$
所以,我想我做错了什么。每当我尝试远程登录时,端口 8080 似乎都没有打开。
如何让我的设备访问我的守护程序端口?
【问题讨论】:
标签: django python-3.x heroku