I tried to implement this basic auth example given in Dash userguide : https://plot.ly/dash/authentication
It thorws me the fllowing error,
Thanks in advance
I tried to implement this basic auth example given in Dash userguide : https://plot.ly/dash/authentication
It thorws me the fllowing error,
Thanks in advance
Hi @Sra1T - Are you using Python3? The current release doesn’t support Python 3 right now. I’ll make a new release today that does.
I have just upgraded the dash-auth
package to 0.0.4
. Upgrade with pip install dash-auth==0.0.4
Hi @chriddyp - thanks for responding,
but I still run into the same problem,
here is the error I get:
Traceback (most recent call last): File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__ return self.wsgi_app(environ, start_response) File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app response = self.handle_exception(e) File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception reraise(exc_type, exc_value, tb) File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise raise value File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise raise value File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/dash_auth/auth.py", line 19, in wrap_index if self.is_authorized(): File "/home/sravanturibilli/anaconda3/lib/python3.6/site-packages/dash_auth/basic_auth.py", line 16, in is_authorized header.split('Basic ')[1]).split(':') TypeError: a bytes-like object is required, not 'str' 127.0.0.1 - - [18/Aug/2017 12:09:50] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 - 127.0.0.1 - - [18/Aug/2017 12:09:50] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 - 127.0.0.1 - - [18/Aug/2017 12:09:50] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 - 127.0.0.1 - - [18/Aug/2017 12:09:50] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
Thanks,
Sravan
Thanks for reporting @Sra1T! Fixed this in https://github.com/plotly/dash-auth/pull/3, could you give it a try with v0.0.5
? pip install dash-auth==0.0.05
. Thanks!
Thanks @chriddyp!, It worked
I have had all sort of problems with the dash auth module. WHen it works locally and then I deploy into aws it does not work, I have seen two scnearios, one where the username/passworkd are asked for repeately and one where only a page saying Login Required is displayed.
I have checked I dont have plot.ly installed ( as seen on other threads) and have both the latest version of dash and dash_auth.
Any ideas?
I dont mind paying for the authentication via plotly but it does not work either. see next post
I also tried the
dash_auth.PlotlyAuth, but I also get an error. Any advice on how to test this locally before deploying…
anyway I went ahead and deployed an app in AWS and got the following error
Thu Aug 30 00:22:48.063222 2018] [:error] [pid 3414] [remote 172.31.33.43:20] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 12, in init
[Thu Aug 30 00:22:48.063225 2018] [:error] [pid 3414] [remote 172.31.33.43:20] self._overwrite_index()
[Thu Aug 30 00:22:48.063230 2018] [:error] [pid 3414] [remote 172.31.33.43:20] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 16, in _overwrite_index
[Thu Aug 30 00:22:48.063232 2018] [:error] [pid 3414] [remote 172.31.33.43:20] original_index = self.app.server.view_functions[‘index’]
[Thu Aug 30 00:22:48.063245 2018] [:error] [pid 3414] [remote 172.31.33.43:20] KeyError: ‘index’
I am not sure what the requirements are… I just copied the example on the website and installed the suggested versions
pip install dash==0.17.8rc2
pip install dash-auth==0.0.4
what are the actual requirements? what am I missing ?
Also it is not clear to me how I link the authorisation part of my app with my paid sucription with plotly
thanks!
UPDATE: I get the same error if I upgrade all packages
[Thu Aug 30 09:35:11.528703 2018] [:error] [pid 3534] [remote 127.0.0.1:188] Auth.init(self, app)
[Thu Aug 30 09:35:11.528708 2018] [:error] [pid 3534] [remote 127.0.0.1:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 12, in init
[Thu Aug 30 09:35:11.528711 2018] [:error] [pid 3534] [remote 127.0.0.1:188] self._overwrite_index()
[Thu Aug 30 09:35:11.528716 2018] [:error] [pid 3534] [remote 127.0.0.1:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 16, in _overwrite_index
[Thu Aug 30 09:35:11.528719 2018] [:error] [pid 3534] [remote 127.0.0.1:188] original_index = self.app.server.view_functions[‘index’]
[Thu Aug 30 09:35:11.528733 2018] [:error] [pid 3534] [remote 127.0.0.1:188] KeyError: ‘index’
[Thu Aug 30 09:41:07.799795 2018] [:error] [pid 3534] [remote 172.31.16.16:188] mod_wsgi (pid=3534): Target WSGI script ‘/opt/python/current/app/application.py’ cannot be loaded as Python module.
[Thu Aug 30 09:41:07.799845 2018] [:error] [pid 3534] [remote 172.31.16.16:188] mod_wsgi (pid=3534): Exception occurred processing WSGI script ‘/opt/python/current/app/application.py’.
[Thu Aug 30 09:41:07.799955 2018] [:error] [pid 3534] [remote 172.31.16.16:188] Traceback (most recent call last):
[Thu Aug 30 09:41:07.799986 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/current/app/application.py”, line 17, in
[Thu Aug 30 09:41:07.799990 2018] [:error] [pid 3534] [remote 172.31.16.16:188] APP_URL
[Thu Aug 30 09:41:07.799996 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/plotly_auth.py”, line 17, in init
[Thu Aug 30 09:41:07.800000 2018] [:error] [pid 3534] [remote 172.31.16.16:188] Auth.init(self, app)
[Thu Aug 30 09:41:07.800006 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 12, in init
[Thu Aug 30 09:41:07.800009 2018] [:error] [pid 3534] [remote 172.31.16.16:188] self._overwrite_index()
[Thu Aug 30 09:41:07.800015 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 16, in _overwrite_index
[Thu Aug 30 09:41:07.800018 2018] [:error] [pid 3534] [remote 172.31.16.16:188] original_index = self.app.server.view_functions[‘index’]
[Thu Aug 30 09:41:07.800032 2018] [:error] [pid 3534] [remote 172.31.16.16:188] KeyError: ‘index’
[Thu Aug 30 09:41:08.027872 2018] [:error] [pid 3534] [remote 172.31.16.16:188] mod_wsgi (pid=3534): Target WSGI script ‘/opt/python/current/app/application.py’ cannot be loaded as Python module.
[Thu Aug 30 09:41:08.027929 2018] [:error] [pid 3534] [remote 172.31.16.16:188] mod_wsgi (pid=3534): Exception occurred processing WSGI script ‘/opt/python/current/app/application.py’.
[Thu Aug 30 09:41:08.028033 2018] [:error] [pid 3534] [remote 172.31.16.16:188] Traceback (most recent call last):
[Thu Aug 30 09:41:08.028200 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/current/app/application.py”, line 17, in
[Thu Aug 30 09:41:08.028208 2018] [:error] [pid 3534] [remote 172.31.16.16:188] APP_URL
[Thu Aug 30 09:41:08.028214 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/plotly_auth.py”, line 17, in init
[Thu Aug 30 09:41:08.028217 2018] [:error] [pid 3534] [remote 172.31.16.16:188] Auth.init(self, app)
[Thu Aug 30 09:41:08.028222 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 12, in init
[Thu Aug 30 09:41:08.028225 2018] [:error] [pid 3534] [remote 172.31.16.16:188] self._overwrite_index()
[Thu Aug 30 09:41:08.028230 2018] [:error] [pid 3534] [remote 172.31.16.16:188] File “/opt/python/run/venv/local/lib/python3.6/site-packages/dash_auth/auth.py”, line 16, in _overwrite_index
[Thu Aug 30 09:41:08.028233 2018] [:error] [pid 3534] [remote 172.31.16.16:188] original_index = self.app.server.view_functions[‘index’]
[Thu Aug 30 09:41:08.028247 2018] [:error] [pid 3534] [remote 172.31.16.16:188] KeyError: ‘index’
This is a really old version of dash-auth
, please try with the latest: 1.1.2
I met the same problem. How did you solve it?