main.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. from jupyterlab_server import LabServerApp, LabConfig
  4. from notebook.utils import url_path_join as ujoin
  5. import os
  6. from traitlets import Unicode
  7. HERE = os.path.dirname(__file__)
  8. # Turn off the Jupyter configuration system so configuration files on disk do
  9. # not affect this app. This helps this app to truly be standalone.
  10. os.environ["JUPYTER_NO_CONFIG"]="1"
  11. class ExampleApp(LabServerApp):
  12. default_url = Unicode('/example',
  13. help='The default URL to redirect to from `/`')
  14. lab_config = LabConfig(
  15. app_name = 'JupyterLab Example App',
  16. app_settings_dir = os.path.join(HERE, 'build', 'application_settings'),
  17. page_url = 'example',
  18. schemas_dir = os.path.join(HERE, 'build', 'schemas'),
  19. settings_dir = os.path.join(HERE, 'build', 'settings'),
  20. static_dir = os.path.join(HERE, 'build'),
  21. templates_dir = os.path.join(HERE, 'templates'),
  22. themes_dir = os.path.join(HERE, 'build', 'themes'),
  23. user_settings_dir = os.path.join(HERE, 'build', 'user_settings'),
  24. workspaces_dir = os.path.join(HERE, 'build', 'workspaces'),
  25. )
  26. def start(self):
  27. settings = self.web_app.settings
  28. # By default, make terminals available.
  29. settings.setdefault('terminals_available', True)
  30. super().start()
  31. if __name__ == '__main__':
  32. ExampleApp.launch_instance()