Waitress¶
Pure Python WSGI server with excellent Windows support. No compilation required.
Use when: Windows deployments, pure Python environments Don’t use when: Need async/WebSockets (use ASGI Mode)
Installation¶
pip install django-prodserver[waitress]
Configuration¶
PRODUCTION_PROCESSES = {
"web": {
"BACKEND": "django_prodserver.backends.servers.waitress.WaitressServer",
"ARGS": {
"host": "0.0.0.0",
"port": "8000",
"threads": "4",
}
}
}
Common ARGS¶
Argument |
Default |
Description |
|---|---|---|
|
|
Host to bind |
|
|
Port to bind |
|
|
Thread count |
|
|
Channel timeout (seconds) |
|
|
Max simultaneous connections |
|
|
Socket backlog |
|
|
Unix socket path (Linux/macOS) |
|
|
Show tracebacks (dev only) |
Examples¶
Production¶
"ARGS": {
"host": "0.0.0.0",
"port": "8000",
"threads": "8",
"connection-limit": "500",
"channel-timeout": "120",
}
Windows¶
"ARGS": {
"host": "0.0.0.0",
"port": "8000",
"threads": "6",
}
Unix Socket¶
"ARGS": {
"unix-socket": "/var/run/myapp.sock",
"threads": "4",
}
Thread Count¶
Low traffic: 2-4 threads
Medium traffic: 4-8 threads
High traffic: 8-16 threads
Troubleshooting¶
Slow responses: Increase threads and channel-timeout
Connection refused under load: Increase connection-limit and backlog