Virtual env: Connection in use error

匿名 (未验证) 提交于 2019-12-03 08:48:34

问题:

I was working on github cloned folder, and created my first ever branch. After switching branches/closing the terminal I went back into my project dir root and ran the usual:

  $ source venv/bin/activate     (venv)$ foreman start     14:13:42 web.1  | started with pid 5591     14:13:42 web.1  | 2014-04-29 14:13:42 [5591] [INFO] Starting gunicorn 18.0     14:13:42 web.1  | 2014-04-29 14:13:42 [5591] [ERROR] Connection in use: ('0.0.0.0', 5000)     14:13:42 web.1  | 2014-04-29 14:13:42 [5591] [ERROR] Retrying in 1 second.     14:13:43 web.1  | 2014-04-29 14:13:43 [5591] [ERROR] Connection in use: ('0.0.0.0', 5000)     14:13:43 web.1  | 2014-04-29 14:13:43 [5591] [ERROR] Retrying in 1 second.     14:13:44 web.1  | 2014-04-29 14:13:44 [5591] [ERROR] Connection in use: ('0.0.0.0', 5000)     14:13:44 web.1  | 2014-04-29 14:13:44 [5591] [ERROR] Retrying in 1 second.     14:13:45 web.1  | 2014-04-29 14:13:45 [5591] [ERROR] Connection in use: ('0.0.0.0', 5000)     14:13:45 web.1  | 2014-04-29 14:13:45 [5591] [ERROR] Retrying in 1 second.     14:13:46 web.1  | 2014-04-29 14:13:46 [5591] [ERROR] Connection in use: ('0.0.0.0', 5000)     14:13:46 web.1  | 2014-04-29 14:13:46 [5591] [ERROR] Retrying in 1 second.     14:13:47 web.1  | 2014-04-29 14:13:47 [5591] [ERROR] Can't connect to ('0.0.0.0', 5000)     14:13:47 web.1  | exited with code 1     14:13:47 system | sending SIGTERM to all processes     SIGTERM received 

And I am receiving this error, and I can't quite figure out what the issue is. Does it have to do with branching?

回答1:

You still have an instance of gunicorn running. foreman runs a daemon instance of gunicorn so if you close terminal down it will still run in the background. For this reason you should always Ctrl + C foreman before closing down terminal. There is however a way to kill the server.

Firstly you can find the id for unicorn to kill it via $ ps ax|grep unicorn and then using the id of the gunicorn instance $ kill <id>

Alternatively you can use $ pkill gunicorn



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!