Not able to connect to django rest server at http://127.0.0.1:8000/

215 Views Asked by At

I have used the same code as the tutorial on the drf website

When i run

python manage.py runserver

it gives me this in the terminal

    Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
July 10, 2021 - 07:12:08
Django version 3.2.5, using settings 'drftut.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Firefox gives me this error:

The connection has timed out

The server at 127.0.0.1 is taking too long to respond.

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.

I'm also using wsl1 and vscode remote desktop for wsl and im running this inside a python enviroment

1

There are 1 best solutions below

3
Karan Rohra On

kill $(lsof -t -i:8000) Use this command in terminal or cmd to kill the process which is already running on PORT 8000. If this is also not worked for you, then try to runserver on another PORT like so python manage.py runserver 5000 or any other free port