gis4dis / poster

Application for geo-spatial data collection and processing.
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Jupyter config error #160

Closed jirik closed 5 years ago

jirik commented 5 years ago
Exception while loading config file /code/jupyter_notebook_config.py
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 562, in _load_config_files
        config = loader.load_config()
      File "/usr/local/lib/python3.6/site-packages/traitlets/config/loader.py", line 457, in load_config
        self._read_file_as_dict()
      File "/usr/local/lib/python3.6/site-packages/traitlets/config/loader.py", line 489, in _read_file_as_dict
        py3compat.execfile(conf_filename, namespace)
      File "/usr/local/lib/python3.6/site-packages/ipython_genutils/py3compat.py", line 198, in execfile
        exec(compiler(f.read(), fname, 'exec'), glob, loc)
      File "/code/jupyter_notebook_config.py", line 16, in <module>
        c.NotebookApp.password = settings.JUPYTER_PASSWORD
      File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
        self._setup(name)
      File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 42, in _setup
        % (desc, ENVIRONMENT_VARIABLE))
    django.core.exceptions.ImproperlyConfigured: Requested setting JUPYTER_PASSWORD, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: OK
Performing system checks...

System check identified no issues (0 silenced).
May 22, 2019 - 11:15:56
Django version 2.1.8, using settings 'poster.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
[I 11:15:57.355 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[I 11:15:57.405 NotebookApp] Serving notebooks from local directory: /code/jupyter-notebooks
[I 11:15:57.405 NotebookApp] The Jupyter Notebook is running at:
[I 11:15:57.405 NotebookApp] http://(031e1f2ec8a4 or 127.0.0.1):8888/
[I 11:15:57.406 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
SLeitgeb commented 5 years ago

I think that the original approach is correct and might be better, as seen here, jupyter notebook loads JUPYTER_TOKEN environment variable automatically, no need to set the password in jupyter_notebook_config.py or elsewhere. As I understand it, token or password can both hold the same values.

Also, ipython_config.py was created as seen in this issue, I think that this is also correct, as the code is executed during IPython initialization so the jupyter notebook can start properly.