由于使用了gunicorn连接,heroku本地网络无法正常工作

use*_*517 0 python django wsgi heroku gunicorn

我克隆了这个heroku-django-starter https://github.com/heroku/heroku-django-template.

我已经做好了 pip install gunicorn

当我运行时heroku local web,我收到以下错误日志.

forego | starting web.1 on port 5000
web.1  | [2016-03-08 21:03:59 -0800] [8288] [INFO] Starting gunicorn 19.4.5
web.1  | [2016-03-08 21:03:59 -0800] [8288] [ERROR] Connection in use: ('0.0.0.0', 5000)
web.1  | [2016-03-08 21:03:59 -0800] [8288] [ERROR] Retrying in 1 second.
web.1  | [2016-03-08 21:04:00 -0800] [8288] [ERROR] Connection in use: ('0.0.0.0', 5000)
web.1  | [2016-03-08 21:04:00 -0800] [8288] [ERROR] Retrying in 1 second.
web.1  | [2016-03-08 21:04:01 -0800] [8288] [ERROR] Connection in use: ('0.0.0.0', 5000)

M00*_*00B 6

这个答案假设您在OSX或Linux等*nix机器上运行.

kill `lsof -i :5000`
Run Code Online (Sandbox Code Playgroud)

这样做会杀死在端口5000上运行的进程.您还可以,如果您想查看端口5000上运行的是什么,请运行以下命令:

ps aux | grep 5000
Run Code Online (Sandbox Code Playgroud)

这将显示正在运行的匹配字符串5000的进程,您可能会看到导致该错误的原因.然后你可以进行kill那个进程id.

另一个选择是在不同的端口上运行您的应用程序,如下所示: heroku local web --port 5001