[英]I can't running django on port 80
I can't running django in my website server at port 80... because It gives me that port is already in use??我无法在我的网站服务器中的端口 80 上运行 django ... 因为它给了我该端口已在使用中? may I know what's the problem exactly?
我可以知道到底是什么问题吗?
this is the link for my website It only gives me a html page (zabarjad.co).这是我网站的链接 它只给了我一个 html 页面 (zabarjad.co)。
but when I type in command line to run django this is what happen:但是当我在命令行中输入运行 django 时会发生这种情况:
aziz@zabarjad-djangostack-vm:/var/www/zabarjadprod$ sudo python3 manage.py runserver 0.0.0.0:80
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
March 06, 2021 - 17:40:17
Django version 2.2.15, using settings 'zabarjadprod.settings'
Starting development server at http://0.0.0.0:80/
Quit the server with CONTROL-C.
Error: That port is already in use.
Aziz, there is something running at port 80 on your system. Aziz,你系统的 80 端口有东西在运行。 check for other services and servers installed on your system and shut down the on the said port.
检查系统上安装的其他服务和服务器并关闭所述端口。
It means there is some other program on your computer running on port 80
.这意味着您的计算机上有其他程序在端口
80
上运行。 I personally have the following shortcut in my ~/.bash_profile
to analyze these sort of things:我个人在我的
~/.bash_profile
中有以下快捷方式来分析这些事情:
alias ports="sudo lsof -iTCP -sTCP:LISTEN -n -P"
If you run it by itself, you should see something along the lines of (assuming you are running MacOS. If not Google, how to find the ports of running processes for your machine):如果你自己运行它,你应该会看到类似的东西(假设你运行的是 MacOS。如果不是谷歌,如何为你的机器找到正在运行的进程的端口):
On the right side, the ports of each process is shown.在右侧,显示了每个进程的端口。 You can then do
kill {PID}
(eg kill 4749
would kill my Spotify instance) to kill the process running on port 80 (make sure it's something you aren't actually using).然后您可以执行
kill {PID}
(例如kill 4749
会杀死我的 Spotify 实例)来终止在端口 80 上运行的进程(确保它是您实际上没有使用的东西)。
I should add, however, than there are very few times that you might want to use port 80
locally.但是,我应该补充一点,您可能希望在本地使用端口
80
的次数很少。 It's better to use 8080
or something else, and only on deployment use 80
.最好使用
8080
或其他东西,并且仅在部署时使用80
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.