|
1 | 1 | # Jupyter Server Configuration |
2 | | -# This configuration disables history requests to prevent Almond kernel |
3 | | -# JSON decoding errors that are harmless but annoying |
| 2 | +# Optimized for Docker container use with minimal warnings |
4 | 3 |
|
5 | 4 | c = get_config() #noqa |
6 | 5 |
|
7 | | -# Disable history access to prevent history_request messages |
8 | | -# that cause JSON decoding errors in Almond 0.9.1 |
9 | | -c.HistoryManager.enabled = False |
10 | | -c.HistoryManager.hist_file = ':memory:' |
| 6 | +# Fix websocket ping timeout warning |
| 7 | +c.ServerApp.websocket_ping_interval = 30 |
| 8 | +c.ServerApp.websocket_ping_timeout = 30 |
11 | 9 |
|
12 | | -# Optional: Reduce logging noise |
13 | | -c.Application.log_level = 'WARN' |
| 10 | +# Disable authentication for local Docker use |
| 11 | +# This eliminates cookie expiration, 403, and WebSocket auth warnings |
| 12 | +c.ServerApp.disable_check_xsrf = True |
| 13 | +c.IdentityProvider.token = '' |
| 14 | +c.ServerApp.allow_origin = '*' |
| 15 | +c.ServerApp.allow_credentials = True |
| 16 | + |
| 17 | +# Keep INFO level for essential startup messages (URL, port, etc) |
| 18 | +# but suppress specific noisy loggers |
| 19 | +c.ServerApp.log_level = 'INFO' |
| 20 | + |
| 21 | +# Suppress tornado HTTP warnings (403, cookie errors) |
| 22 | +import logging |
| 23 | +logging.getLogger('tornado.access').setLevel(logging.ERROR) |
| 24 | +logging.getLogger('tornado.application').setLevel(logging.ERROR) |
| 25 | + |
| 26 | +# Create a custom filter to suppress specific warning messages |
| 27 | +class SuppressAuthWarning(logging.Filter): |
| 28 | + def filter(self, record): |
| 29 | + return 'All authentication is disabled' not in record.getMessage() |
| 30 | + |
| 31 | +# Apply the filter to ServerApp logger |
| 32 | +server_logger = logging.getLogger('ServerApp') |
| 33 | +server_logger.addFilter(SuppressAuthWarning()) |
0 commit comments