在外部服务器上,我尝试运行以下命令:
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
[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)
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决此问题?
小智 7
这对我有用:
pgrep gunicorn
Run Code Online (Sandbox Code Playgroud)
它会返回 pid,如下所示:
23716
23718
Run Code Online (Sandbox Code Playgroud)
现在使用以下命令杀死其中任何一个(或全部):
kill 23716
Run Code Online (Sandbox Code Playgroud)
您可以重新检查pgrep gunicorn它是否仍在运行。
错误信息:
使用中的连接:('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
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,它guincorn的 pid 为125004.
(来源)
我遇到了同样的错误,但我所做的就是从这个命令中杀死我的端口 8000。
sudo fuser -k 8000/tcp
Run Code Online (Sandbox Code Playgroud)
现在你可以运行命令
gunicorn --bind 0.0.0.0:8000 jeremiesblog.wsgi:application
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6920 次 |
| 最近记录: |