问题描述
我早些时候被处死
#include <iostream>
#include <fstream>
#include <time.h>
#include <conio.h>
int hs;
//this would be the play_game() function,unrelated to the subject
int main()
{
std::ofstream fout;
fout.open("HS.txt");
std::ifstream fin;
fin.open("HS.txt");
srand(time(NULL));
//menu with 4 options,play,quit,help and highscore (which i'm working on)
fin.close();
fout.close();
}
它曾经在我的本地主机http://127.0.0.1:8000/上启动服务器
但是现在不知何故,当我现在键入它并按Enter时,什么也没有发生,光标只是转到下一个提示。
但是如果我输入
python3 manage.py runserver
它可以正常工作并启动服务器。
可能是什么问题?正在执行ctrl + C不会停止已经在运行的服务器吗?如何确定我是否还在后台运行其他服务器?
解决方法
如果您已经在后台运行服务,则表明端口8000已在使用中。例如,如果您使用其他端口启动django,例如:
python3 manage.py runserver 127.0.0.1:4000
,您需要检查进程是否仍在后台运行:
jobs
查看[本文] [1]了解更多信息。请注意,如果正在运行:
python3 manage.py runserver 127.0.0.1:8000
不会引发任何错误,这与后台作业无关。
[1]:https://study.com/academy/lesson/background-processes-in-linux-definition-manipulation.html#:~:text=In%20Linux%20terminology%20(and%20in,可用%20to%20执行%20other%20命令。
,您可以使用
netstat -nltp
检查使用的端口。
并使用
关闭或杀死它kill -9 PID