python3 manage.py runserver does not work without specifying the localhost

713 Views Asked by At

Earlier when I executed,

python3 manage.py runserver

It used to start the server at my localhost http://127.0.0.1:8000/

but somehow it isnt doing so now, when I type it in now and press enter, nothing happens and the cursor just goes to the next prompt.

However if I type in,

python3 manage.py runserver 127.0.0.1:8000

It works correctly and starts the server.

What could be the issue? Is doing ctrl+C not stopping the already running server? How do I find out if I have any other servers still running in the background?

2

There are 2 best solutions below

2
Zhivko Zaikov On

If you have already running services in the background it would say that port 8000 is already in use. If for example you have started django with different port, for example:

python3 manage.py runserver 127.0.0.1:4000

and you need to check if the process is still running in the background type:

jobs

Check [this article][1] for more information. Note that if running:

python3 manage.py runserver 127.0.0.1:8000

does not throw any errors, this is not related to background jobs.

[1]: https://study.com/academy/lesson/background-processes-in-linux-definition-manipulation.html#:~:text=In%20Linux%20terminology%20(and%20in,available%20to%20execute%20other%20commands.

3
ron_olo On

You can use

netstat -nltp

to check used ports.

And close or kill it using

kill -9 PID