Django / Laravel / PHP

Development on Port 8000?

The standard port for Python Django, PHP Laravel, and simple HTTP servers.

Open http://localhost:8000
Seeing "DisallowedHost"? Fix Django settings below.

Troubleshooting Port 8000

Port 8000 is favored by backend frameworks. Here are the most common stack-specific errors.

1. Django: "DisallowedHost at /"

Django prevents external access by default for security. If you see a debug page saying the host is disallowed, you must edit your settings.

Open settings.py and modify ALLOWED_HOSTS:

ALLOWED_HOSTS = ['localhost', '127.0.0.1']

Then restart your server: python manage.py runserver

2. Instant Python Web Server

Need to share a folder locally? You don't need Apache or Nginx. Use Python's built-in one-liner.

Python 3 (Most Common):

python -m http.server 8000

Python 2 (Legacy):

python -m SimpleHTTPServer 8000

3. PHP & Laravel Artisan

If you are using Laravel, ensure you start the development server correctly.

php artisan serve --port=8000

If connection is refused, check if you have PHP installed via php -v.

4. Port 8000 Already in Use?

If your previous server didn't close properly, you need to free up the port.

# Mac / Linux
lsof -i :8000
kill -9 [PID]