GibbsConsulting / jupyter-plotly-dash

Jupyter notebook wrapper for plotly dash applications
GNU Affero General Public License v3.0
81 stars 12 forks source link

Improperly Configured error on running #33

Closed nylocx closed 5 years ago

nylocx commented 5 years ago

I installed with pip install jupyter_plotly_dash and everything seemed to run fine there. But if I try these two simple lines:

from jupyter_plotly_dash import JupyterDash
JupyterDash('SomeID')

I get an error from the Django Backend stuff. I have no idea how to fix this as I don't have a settings.py.

ImproperlyConfigured                      Traceback (most recent call last)
<ipython-input-26-2733af58b9a2> in <module>
      1 from jupyter_plotly_dash import JupyterDash
----> 2 JupyterDash('SomeID')

/opt/conda/lib/python3.6/site-packages/jupyter_plotly_dash/dash_wrapper.py in __init__(self, name, gav, width, height)
      7 class JupyterDash:
      8     def __init__(self, name, gav=None, width=800, height=600):
----> 9         self.dd = DjangoDash(name)
     10         self.gav = gav and gav or get_global_av()
     11         self.gav.add_application(self, name)

/opt/conda/lib/python3.6/site-packages/django_plotly_dash/dash_wrapper.py in __init__(self, name,
serve_locally, expanded_callbacks, add_bootstrap_links, suppress_callback_exceptions, **kwargs)
    109 
    110         if serve_locally is None:
--> 111             self._serve_locally = serve_locally_setting()
    112         else:
    113             self._serve_locally = serve_locally

/opt/conda/lib/python3.6/site-packages/django_plotly_dash/util.py in serve_locally()
    111 
    112 def serve_locally():
--> 113     return _get_settings().get('serve_locally', settings.DEBUG)

/opt/conda/lib/python3.6/site-packages/django_plotly_dash/util.py in _get_settings()
     32 def _get_settings():
     33     try:
---> 34         the_settings = settings.PLOTLY_DASH
     35     except AttributeError:
     36         the_settings = None

/opt/conda/lib/python3.6/site-packages/django/conf/__init__.py in __getattr__(self, name)
     77         """Return the value of a setting and cache it in self.__dict__."""
     78         if self._wrapped is empty:
---> 79             self._setup(name)
     80         val = getattr(self._wrapped, name)
     81         self.__dict__[name] = val

/opt/conda/lib/python3.6/site-packages/django/conf/__init__.py in _setup(self, name)
     62                 "You must either define the environment variable %s "
     63                 "or call settings.configure() before accessing settings."
---> 64                 % (desc, ENVIRONMENT_VARIABLE))
     65 
     66         self._wrapped = Settings(settings_module)

ImproperlyConfigured: Requested setting PLOTLY_DASH, but settings are not configured. You must
either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
before accessing settings.
GibbsConsulting commented 5 years ago

@nylocx thanks for reporting, this is a bug - the underlying dpd library is now insisting on settings being present and not using defaults

czen commented 5 years ago

Hello, I'm currently having the same issue:

~/pentane/lib/python3.7/site-packages/django/conf/__init__.py in __getattr__(self, name)
     77         """Return the value of a setting and cache it in self.__dict__."""
     78         if self._wrapped is empty:
---> 79             self._setup(name)
     80         val = getattr(self._wrapped, name)
     81         self.__dict__[name] = val

~/pentane/lib/python3.7/site-packages/django/conf/__init__.py in _setup(self, name)
     62                 "You must either define the environment variable %s "
     63                 "or call settings.configure() before accessing settings."
---> 64                 % (desc, ENVIRONMENT_VARIABLE))
     65 
     66         self._wrapped = Settings(settings_module)

ImproperlyConfigured: Requested setting PLOTLY_DASH, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Is there any workaround for this yet?

jmileson commented 5 years ago

pip install -U django-plotly-dash==0.9.8 fixed this issue for me.

czen commented 5 years ago

That worked, thanks!

GibbsConsulting commented 5 years ago

PR #35 has been pulled into master, and released as v0.2.1 This issue should now be resolved; if not then either reopen this issue or create a new one.