jupyter_notebook_config.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. '--ServerApp.base_url={base_url}lab-dev',
  17. ] + common + ['>jupyterlab-dev.log 2>&1'])
  18. lab_splice_command = ' '.join([
  19. 'jupyter',
  20. 'lab',
  21. 'build',
  22. '--splice-source',
  23. '--minimize=False',
  24. '--dev-build=True',
  25. '--debug',
  26. '>jupyterlab-spliced.log 2>&1',
  27. '&&',
  28. 'jupyter',
  29. 'lab',
  30. '--ServerApp.base_url={base_url}lab-spliced',
  31. ] + common + ['>jupyterlab-spliced.log 2>&1'])
  32. c.ServerProxy.servers = {
  33. 'lab-dev': {
  34. 'command': [
  35. '/bin/bash', '-c', lab_command
  36. ],
  37. 'timeout': 60,
  38. 'absolute_url': True
  39. },
  40. 'lab-spliced': {
  41. 'command': [
  42. '/bin/bash', '-c', lab_splice_command
  43. ],
  44. 'timeout': 300,
  45. 'absolute_url': True
  46. }
  47. }
  48. c.NotebookApp.default_url = '/lab-dev'
  49. import logging
  50. c.NotebookApp.log_level = logging.DEBUG