Python development

localhost:8000

Port 8000 is a convention, not a universal application. Django’s development server uses it by default, while FastAPI, Python’s file server, and other tools use it only when configured to do so. Identify the process before changing anything.

Checked with Django 5.2 and Python 3.13Windows · macOS · LinuxUpdated September 5, 2026
Django default127.0.0.1:8000
Common protocolHTTP
Production ready?No
RoutesApp-defined

First identify the service

A port number cannot tell you which framework owns it. Start with the terminal that launched the app, then inspect the listener:

# Windows PowerShell
Get-NetTCPConnection -LocalPort 8000 -State Listen |
  Select-Object LocalAddress, LocalPort, OwningProcess
Get-Process -Id <PID>

# macOS or Linux
lsof -nP -iTCP:8000 -sTCP:LISTEN

Probe the root without assuming that a browser page exists:

curl -i http://127.0.0.1:8000/

Start the intended server

ToolCommandWhat to expect
Djangopython manage.py runserverDevelopment server on 127.0.0.1:8000 by default.
Django, LAN testpython manage.py runserver 0.0.0.0:8000Listens on all interfaces; use the computer’s LAN IP from another device.
Python filespython -m http.server 8000 --bind 127.0.0.1Serves the current directory. It is not a Django or API server.
FastAPI with Uvicornuvicorn main:app --host 127.0.0.1 --port 8000Serves the ASGI app named app from main.py.

Django’s runserver is for development only. Django’s own documentation says it is not designed for production. Binding to 0.0.0.0 also makes it reachable beyond your browser, so use a trusted network and firewall.

Why /admin or /docs returns 404

localhost:8000/admin and /docs are not features of the port. Routes come from the application currently listening there.

  • Django admin: the project must include django.contrib.admin and map path("admin/", admin.site.urls). The trailing slash matters with common Django settings.
  • FastAPI docs: Swagger UI normally appears at /docs unless the app disables or changes docs_url.
  • Python http.server: it serves files and directories. It has no application admin or API documentation route.

A framework-generated 404 is useful evidence: the network connection succeeded, but the requested application route does not exist.

Diagnose the actual failure

ResultInterpretationAction
Connection refusedNo process is listening at the resolved address and port.Start the server; confirm the exact bind address and port.
Address already in useAnother process owns 8000.Identify it, stop it if appropriate, or start on another port such as 8001.
404 responseThe server is reachable; the path is wrong or not registered.Inspect the app’s route configuration.
400 Bad Request in DjangoThe hostname may not be permitted by ALLOWED_HOSTS.Add the precise development hostname; do not use a wildcard without understanding the risk.
Works on this computer onlyThe server probably listens on loopback, or the firewall blocks LAN traffic.Bind deliberately to a LAN-reachable interface and permit only the needed network.

A reproducible test sequence

  1. Run the documented start command and keep its terminal open.
  2. Confirm the printed URL and check the listener.
  3. Request / with curl -i.
  4. Only after the root responds, test framework-specific paths such as /admin/ or /docs.
  5. If another device is involved, test the machine’s LAN IP and verify both binding and firewall rules.

Official references