0

I have setup a Django project on a virtual environment on my PC. When using the command

python manage.py runserver 0.0.0.0:8000

Bit Bash stops doing anything and I have to end the program to start over. I have waited several minutes and when I end the session, a dialogue says:

Processes are running in session:
WPID  PID    COMMAND
14904 1534 c:\Users\mine\AppData\Loca
Close anyway?

I have looked at every related question to this and tried every solution but I cannot get this to work, on or off the virtual environment.

Not sure if this applies, but I also noticed that in my task manager, python3.9.exe appears twice when trying to start the server. The status says running, and the PIDs are different numbers.

Michael Rader
  • 5,839
  • 8
  • 33
  • 43

6 Answers6

0

This is because something already running on port 8000. You can run the Django server by hosting on another port like 8080 but, you can also kill the already running task on the port. Follow the link to know how exactly you can kill any running process.

Muhammad Hammad
  • 183
  • 1
  • 11
0

It is highly likely that another application is running using the port 8000. Try running the server using another port, say 8088 and share if the same issue persists.

  • The author of the question has already commented that the problem is not caused by another application using the port 8000. – Alain Bianchini Sep 01 '21 at 16:40
  • Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Sep 01 '21 at 16:41
0

To run on specific port kill all pids which is showing you on Git bash (ps -ef)... kill them using (kill -9 pid_no)... then run your runserver command.

Ex:

ps -ef
kill -9 123
joanis
  • 10,635
  • 14
  • 30
  • 40
0

I ended up paying someone to fix this. Here is the conversation I had with the person who found the issue. Hope this helps someone out there.

Also, I noticed sometimes it still does freeze up on the watching for file changes with StateReloader until I go the browser and type in http://localhost:8000/. Once I do that the rest of the text loads and my browser shows The install worked successfully! Congratulations!

it works, what did you do?
- We have existing processes on port 8000.I think, you had the server running and kept trying over and over. So, I killed process using 8000 port.
- Next, I run Django project again.
- So, now it's working well.

ok. Can you tell me what you did at the start to make it work? Or was it always working?
- I started git bash session again when I started. Maybe git bash session had problems.
But this was going on for a day, I restarted the computer several times and restarted git bash. Same issue.
You must have done something.
- Sorry, I didn't do anything except restart git bash
how did you restart it?
- right click top of window, select NEW

How do I turn server off?
- press Ctrl + C

- And you didn't quit the server exactly before. Maybe you closed git bash directly and server was still live
- So, we had many 8000 ports.

Ok. How can I see what is on that port now?
- You can use this cli
- netstat -ano | findstr :<PORT>

- We don't have running 8000 port now.
Michael Rader
  • 5,839
  • 8
  • 33
  • 43
0

I have never found solutions to this problem even with killing ports, changing port etc.

enter image description here

It never display the following part:

Starting development server at http://127.0.0.1:8000/

However, when I use the Git Bash terminal include into vscode, it displays the url.

Terminal > New Terminal > then:

enter image description here

Result :

enter image description here

Pozinux
  • 964
  • 2
  • 10
  • 22
-1

python manage.py runserver 127.0.0.1:8080