Git Product home page Git Product logo

Comments (12)

lapshinmr avatar lapshinmr commented on July 17, 2024 1

Hey. Please, take a look at these pages: issue133 and https://dash.plotly.com/urls. It looks like your problem not in the login feature but in the multi-page rendering.

from dash-flask-login.

RafaelMiquelino avatar RafaelMiquelino commented on July 17, 2024 1

Another possibility that appears to solve this same issue: #2

from dash-flask-login.

RafaelMiquelino avatar RafaelMiquelino commented on July 17, 2024

from dash-flask-login.

max454545 avatar max454545 commented on July 17, 2024

Hello Rafael,
Thanks for getting back so quickly.

I changed your code by adding the following line to app.py:

app = app.server

I made the above change in order to use the flask internal server. Is this where I am going wrong?

The gif below shows the behavior on a local server (browser on the left), vs the behavior on a hosted server (browser window on the right). In the hosted version, CURRENT USER: TEST disappears because the current_user.is_authenticated is prematurely set to False.

prob_gif

from dash-flask-login.

RafaelMiquelino avatar RafaelMiquelino commented on July 17, 2024

I changed your code by adding the following line to app.py:

app = app.server

I made the above change in order to use the flask internal server. Is this where I am going wrong?

You shouldn’t need to do that, just run flask run --host=0.0.0.0 and your app you’ll be served externally. However I recommended you use gunicorn, the Flask internal server is not suitable for production environment. Take a look here for an example on how to serve the app with gunicorn: https://github.com/RafaelMiquelino/flask-text-reader/blob/master/README.md#instructions.

from dash-flask-login.

max454545 avatar max454545 commented on July 17, 2024

I have tried gunicorn on a Heroku server (still with the line 'server = app.server') and the problem persisted.

I will try flask run --host=0.0.0.0 and get back to you.

Thank you again

from dash-flask-login.

max454545 avatar max454545 commented on July 17, 2024

I am truly stuck.
Our preferred host uses passenger as the application server. The only way that I can think of making the passenger_wsgi.py file is by adding the line 'server = app.server' to app.y, which is the incorrect way to do it.

Do you know how I could make the passenger_wsgi.py file to correctly run
dash-flask-login, without altering app.py?

from dash-flask-login.

max454545 avatar max454545 commented on July 17, 2024

I see that dash-auth-flow is also nolonger working in production. Is it possible that Flask login is no longer a viable option for Dash apps?

Here is there app, it exhibits the same faulty behavior as dash-flask-login on my server:
http://dash-auth-flow.herokuapp.com/login

from dash-flask-login.

RafaelMiquelino avatar RafaelMiquelino commented on July 17, 2024

@max454545 , I just made some tests and deployed it to Heroku and it behaves like expected, i.e.: I couldn't reproduce your issue. I added the instructions to run it with gunicorn and deploy to Heroku on the README. If you follow this instructions you'll be able to do that too.
I have a working example on the link https://dash-flask-login-rm.herokuapp.com that you can check by yourself. You'll probably need to investigate deeper your code and please share here when you managed to solve it.

from dash-flask-login.

RafaelMiquelino avatar RafaelMiquelino commented on July 17, 2024

Actually, I checked it again and it indeed behaves in a strange manner. Maybe there is something to do what @lapshinmr just mentioned.

from dash-flask-login.

RafaelMiquelino avatar RafaelMiquelino commented on July 17, 2024

So I forced gunicorn to use only one worker when running on Heroku: https://github.com/RafaelMiquelino/dash-flask-login/blob/master/Procfile#L1.
It is working now but it is more a workaround than a solution. It seems the issue is really related to the mentioned above by @lapshinmr. The Dash maintainer says it is solved from the version 0.11.0 but we are using the version 1.4.1 here and the issue is still there, so it needs to be further investigated.
@max454545, you should probably work on a more robust solution for your case and if you find, please share it here. For the moment I'm closing this issue as this is not related to the login process but to the multi-page rendering process.

from dash-flask-login.

max454545 avatar max454545 commented on July 17, 2024

Thank you @lapshinmr and @RafaelMiquelino for looking into the issue, I appreciate it.

lapshinmr you are completely correct it is not the login feature but in the multi-page rendering.

github.com/russellromney seems to have encountered the same problem and found a solution:
russellromney/dash-auth-flow#2

by using

from dash-flask-login.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.