main.py 1.4 KB

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