Django 在Heroku上运行我自己的守护程序,我如何从Internet联系它?
我有一个Django应用程序,在Heroku上运行良好。现在,我想启动第二个进程,该进程实现一个守护进程,该守护进程与其他设备交换数据并填充Django应用程序的数据库 我将第二个守护进程实现为Django应用程序的自定义命令,因此在我的Django 在Heroku上运行我自己的守护程序,我如何从Internet联系它?,django,python-3.x,heroku,Django,Python 3.x,Heroku,我有一个Django应用程序,在Heroku上运行良好。现在,我想启动第二个进程,该进程实现一个守护进程,该守护进程与其他设备交换数据并填充Django应用程序的数据库 我将第二个守护进程实现为Django应用程序的自定义命令,因此在我的Procfile中 web: gunicorn portal.wsgi --log-file - listener: python manage.py listen_to_devices 此时,我使用heroku ps:scale listener=1启动守护
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端口时,它似乎并没有打开
我如何让我的设备到达我的守护程序端口
我如何让我的设备到达我的守护程序端口
你不能
至少,如果您已经有另一个进程正在侦听web流量,那么您不能这样做,还有希罗库
根据它的功能,您可能可以将守护程序作为单独的Heroku应用程序运行,但一般来说,应用程序希望看到HTTP流量