AzizMayo29
AzizMayo29

Reputation: 3

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?? may I know what's the problem exactly?

this is the link for my website It only gives me a html page (zabarjad.co).

but when I type in command line to run django this is what happen:

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.

Upvotes: 0

Views: 1446

Answers (2)

Chymdy
Chymdy

Reputation: 660

Aziz, there is something running at port 80 on your system. check for other services and servers installed on your system and shut down the on the said port.

Upvotes: 1

felipe
felipe

Reputation: 8025

It means there is some other program on your computer running on port 80. I personally have the following shortcut in my ~/.bash_profile to analyze these sort of things:

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):

enter image description here

On the right side, the ports of each process is shown. You can then do kill {PID} (e.g. 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).


I should add, however, than there are very few times that you might want to use port 80 locally. It's better to use 8080 or something else, and only on deployment use 80.

Upvotes: 0

Related Questions