diff --git a/appmode/server_extension.py b/appmode/server_extension.py index a4ff236..4c90508 100644 --- a/appmode/server_extension.py +++ b/appmode/server_extension.py @@ -6,6 +6,7 @@ from notebook.base.handlers import IPythonHandler, FilesRedirectHandler, path_regex import notebook.notebook.handlers as orig_handler from tornado import web +import json class AppmodeHandler(IPythonHandler): #=========================================================================== @@ -17,6 +18,7 @@ def get(self, path): user_name = path_split.pop(1) # global environment variables are lazy but easiest way to pass username os.environ['APPMODE_USER']=user_name + os.environ['APPMODE_SETTINGS'] = json.dumps(self.settings) path = '/'.join(path_split) path = path.strip('/') self.log.info('Appmode get: %s', path) diff --git a/example_app.ipynb b/example_app.ipynb index 2c1686f..d7e4ba1 100644 --- a/example_app.ipynb +++ b/example_app.ipynb @@ -7,7 +7,8 @@ "outputs": [], "source": [ "import os\n", - "USERNAME=os.environ.get('APPMODE_USER', 'Not logged in')" + "USERNAME=os.environ.get('APPMODE_USER', 'Not logged in')\n", + "print(os.environ.get('APPMODE_SETTINGS', ''), 'settings loaded')" ] }, {