jupyter_notebook_config.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. common = [
  2. '--no-browser',
  3. '--debug',
  4. '--port={port}',
  5. '--ServerApp.ip=127.0.0.1',
  6. '--ServerApp.token=""',
  7. # Disable dns rebinding protection here, since our 'Host' header
  8. # is not going to be localhost when coming from hub.mybinder.org
  9. '--ServerApp.allow_remote_access=True'
  10. ]
  11. lab_command = ' '.join([
  12. 'jupyter',
  13. 'lab',
  14. '--dev-mode',
  15. '--extensions-in-dev-mode',
  16. '--collaborative',
  17. '--ServerApp.base_url={base_url}lab-dev',
  18. ] + common + ['>jupyterlab-dev.log 2>&1'])
  19. lab_splice_command = ' '.join([
  20. 'jupyter',
  21. 'lab',
  22. 'build',
  23. '--splice-source',
  24. '--minimize=False',
  25. '--dev-build=True',
  26. '--debug',
  27. '>jupyterlab-spliced.log 2>&1',
  28. '&&',
  29. 'jupyter',
  30. 'lab',
  31. '--ServerApp.base_url={base_url}lab-spliced',
  32. ] + common + ['>jupyterlab-spliced.log 2>&1'])
  33. c.ServerProxy.servers = {
  34. 'lab-dev': {
  35. 'command': [
  36. '/bin/bash', '-c', lab_command
  37. ],
  38. 'timeout': 60,
  39. 'absolute_url': True
  40. },
  41. 'lab-spliced': {
  42. 'command': [
  43. '/bin/bash', '-c', lab_splice_command
  44. ],
  45. 'timeout': 300,
  46. 'absolute_url': True
  47. }
  48. }
  49. c.NotebookApp.default_url = '/lab-dev'
  50. import logging
  51. c.NotebookApp.log_level = logging.DEBUG