localhost:5000
Two big frameworks share port 5000: Flask (Python) and ASP.NET Core (.NET). If you're building Python web apps or .NET APIs, this is your default dev address.
What Uses Port 5000?
| Framework | Language |
|---|---|
| Flask | Python |
| ASP.NET Core | C# / .NET |
| Docker Registry | Container |
| AirPlay (Mac) | System service |
Flask Quick Start
# app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug=True) # Runs on localhost:5000
# Run Flask
python app.py
# Or with flask command
flask run
ASP.NET Core
# Create new project
dotnet new webapi -o MyApi
cd MyApi
dotnet run
# Runs on http://localhost:5000 (HTTP)
# and https://localhost:5001 (HTTPS)
Change Flask Port
# In code
app.run(port=3000)
# Command line
flask run --port 3000
# Environment variable
export FLASK_RUN_PORT=3000
Mac: AirPlay Conflict
On macOS Monterey+, AirPlay Receiver uses port 5000. Fix:
- System Preferences → Sharing → Disable "AirPlay Receiver"
- Or use a different port:
flask run --port 5001