gunicorn 服务器启动时出错
Error with gunicorn server start
在外部服务器上,我尝试运行命令:
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
我收到这个错误:
[2017-01-29 15:08:02 +0000] [19640] [INFO] Starting gunicorn 19.4.5
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:07 +0000] [19640] [ERROR] Can't connect to ('0.0.0.0', 8000)
我该怎么做才能解决这个问题?
错误信息:
Connection in use: ('0.0.0.0', 8000)
表示端口正在使用中。您需要找到当前正在使用该端口的人并将其关闭。如果可以sudo
,可以使用netstat
查找谁已经在使用该端口:
$ sudo netstat -nlp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/gunicorn
在上面的示例中,它是 guincorn
,pid 为 125004
。
(Source)
我遇到了同样的错误,但我所做的只是通过此命令终止我的端口 8000。
sudo fuser -k 8000/tcp
现在您可以运行命令
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
这对我有用:
pgrep gunicorn
它会 return 你 pid,像这样:
23716
23718
现在使用以下方法杀死其中任何一个(或全部):
kill 23716
如果它仍然是 运行,您可以使用 pgrep gunicorn
重新检查。
在外部服务器上,我尝试运行命令:
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
我收到这个错误:
[2017-01-29 15:08:02 +0000] [19640] [INFO] Starting gunicorn 19.4.5
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:02 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:03 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:04 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:05 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Connection in use: ('0.0.0.0', 8000)
[2017-01-29 15:08:06 +0000] [19640] [ERROR] Retrying in 1 second.
[2017-01-29 15:08:07 +0000] [19640] [ERROR] Can't connect to ('0.0.0.0', 8000)
我该怎么做才能解决这个问题?
错误信息:
Connection in use: ('0.0.0.0', 8000)
表示端口正在使用中。您需要找到当前正在使用该端口的人并将其关闭。如果可以sudo
,可以使用netstat
查找谁已经在使用该端口:
$ sudo netstat -nlp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/gunicorn
在上面的示例中,它是 guincorn
,pid 为 125004
。
(Source)
我遇到了同样的错误,但我所做的只是通过此命令终止我的端口 8000。
sudo fuser -k 8000/tcp
现在您可以运行命令
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
这对我有用:
pgrep gunicorn
它会 return 你 pid,像这样:
23716
23718
现在使用以下方法杀死其中任何一个(或全部):
kill 23716
如果它仍然是 运行,您可以使用 pgrep gunicorn
重新检查。