Settings reference¶
All settings are placed under the CHANNELS_SPECTACULAR_SETTINGS dict in
your Django settings file.
CHANNELS_SPECTACULAR_SETTINGS = {
# key: default_value
}
Full reference¶
Key |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Title used in the AsyncAPI |
|
|
|
API version in the |
|
|
|
Markdown description in the |
|
|
|
Default WebSocket path used when |
|
|
|
Verbatim AsyncAPI |
|
|
|
Override host when |
|
|
|
Override protocol when |
|
|
|
Query parameter name for token auth (e.g. |
|
|
|
Cookie name for JWT cookie auth (e.g. |
|
|
|
Show the interactive WebSocket console in the docs viewer. Keep |
|
|
|
When |
Example: production + dev split¶
# settings/base.py
CHANNELS_SPECTACULAR_SETTINGS = {
"TITLE": "Dispatch API",
"VERSION": "1.0.0",
"DESCRIPTION": "Real-time ride and delivery dispatch over WebSocket.",
"CHANNEL_PATH": "/ws/dispatch/",
"TRY_IT_OUT_ENABLED": False,
}
# settings/dev.py
CHANNELS_SPECTACULAR_SETTINGS = {
**CHANNELS_SPECTACULAR_SETTINGS,
"WS_HOST": "localhost:8000",
"WS_PROTOCOL": "ws",
"TRY_IT_OUT_ENABLED": True,
}
# settings/prod.py
CHANNELS_SPECTACULAR_SETTINGS = {
**CHANNELS_SPECTACULAR_SETTINGS,
"SERVERS": {
"production": {
"host": "api.example.com",
"protocol": "wss",
"description": "Production WebSocket server",
},
},
}