Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django manage.py runserver is not working

I am facing problem while trying to start the server using the command

python manage.py runserver 0.0.0.0:8000

It is showing

C:\abc>python manage.py runserver 0.0.0.0:8000
Validating models...

0 errors found
Django version 1.4.9, using settings 'abc.settings'
Development server is running at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.

But cant access in browser via http://127.0.0.1:8000

It is showing :

Unable to connect

Firefox can't establish a connection to the server at 127.0.0.1:8000.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

But when I am trying the same by

python manage.py runserver 

it is working fine. i can access the application http://127.0.0.1:8000

What can be the issue.

like image 486
curiousguy Avatar asked Jan 27 '14 07:01

curiousguy


People also ask

What happens when we run python manage py Runserver?

This executes the command and perform base checks if needed. This performs normal checks and migration checks if needed and then calls a function called handle . This function makes all the checks regarding IP address like checking port, IP address format ipv4 or ipv6.

How do I run python py Runserver on different ports?

Find the DEFAULT_PORT field. it is equal to 8000 by default. Change it to whatever you like DEFAULT_PORT = "8080" Restart your server: python manage.py runserver and see that it uses your set port number.


1 Answers

It looks like Port 8000 is in use by your external IP. Please have a look if a process is running and kill it.

You can check the open ports with netstat -a. In Debian you get the PID with netstat -tulpn | grep 8000. The last line should display something like 1234/python. Now kill it with kill 1234.

Alternative you could restart your system ;-)

like image 180
Thomas Schwärzl Avatar answered Oct 17 '22 00:10

Thomas Schwärzl