关闭Django中的套接字 - 错误:[Errno 48]地址已被使用

Ide*_*REX 5 python django

我不小心在api调用上创建了一个无限循环.它失控了,我不得不把它关闭[control + C].

现在当我这样做

$ python manage.py runserver
Run Code Online (Sandbox Code Playgroud)

我明白了

Validating models...

0 errors found
August 08, 2013 - 12:43:41
Django version 1.5.1, using settings 'summertime.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Error: [Errno 48] Address already in use
Run Code Online (Sandbox Code Playgroud)

有谁知道如何重置套接字?我可以关闭我的电脑吗?

Vic*_*res 7

你有两个选择,第一个是选择另一个端口:

python manage.py runserver 8080
Run Code Online (Sandbox Code Playgroud)

另一个是在港口杀死进程,以find the process:

sudo netstat -tulpn | grep :8000
Run Code Online (Sandbox Code Playgroud)

kill the process:

kill -9 <pid-of-process>
Run Code Online (Sandbox Code Playgroud)


Den*_*gin 6

看看你是否已经使用runserver

ps -ef | grep runserver
Run Code Online (Sandbox Code Playgroud)

杀死它使用

pkill -9 -f runserver
Run Code Online (Sandbox Code Playgroud)

(pkill按名称杀死东西)