Giter VIP home page Giter VIP logo

Comments (11)

Bachibouzouk avatar Bachibouzouk commented on May 24, 2024 2

@shammamah : I did

import dash


def run_standalone_app(layout, callbacks, port=8050, debug=True):

    app = dash.Dash()
    app.scripts.config.serve_locally = True
    app.config["suppress_callback_exceptions"] = True

    server = app.server

    app.layout = layout()  # assign layout
    callbacks(app)  # register all of the callbacks
    app.run_server(debug=debug, port=port)

in a app_standalone.py file in tests/dashbio_demos/utils, then

if __name__ == '__main__':
    from tests.dashbio_demos.utils.app_standalone import run_standalone_app
    run_standalone_app(layout, callbacks)

at the end of an app file works (for me at least).
Then the css needs to be linked properly :)

from dash-bio.

Bachibouzouk avatar Bachibouzouk commented on May 24, 2024 1

@mkcor I don't have a branch for this yet, you can create it :)

from dash-bio.

mkcor avatar mkcor commented on May 24, 2024 1

Aww unrelated but app_molecule3d.py must have been written on Windows because I'm stuck in this nightmare https://stackoverflow.com/questions/64749/m-character-at-end-of-lines :(

from dash-bio.

mkcor avatar mkcor commented on May 24, 2024 1

@shammamah Oh, of course it works locally!! haha
Will edit ;)

from dash-bio.

shammamah-zz avatar shammamah-zz commented on May 24, 2024

@mkcor @Bachibouzouk We can easily convert each app_[] file to a standalone app by adding the following lines:

app = dash.Dash()
app.scripts.config.serve_locally = True
app.config["suppress_callback_exceptions"] = True 

server = app.server

somewhere in the beginning of the file and

if __name__ == '__main__':
    app.layout = layout() # assign layout 
    callbacks(app) # register all of the callbacks 
    app.run_server(debug=True)

at the end. Will try this out with one of our applications and confirm :)

from dash-bio.

shammamah-zz avatar shammamah-zz commented on May 24, 2024

@Bachibouzouk Great idea -- then all we really need to change is the Procfile for each application :)

from dash-bio.

mkcor avatar mkcor commented on May 24, 2024

Ok! @Bachibouzouk Do you have a work-in-progress branch for this, that I should piggyback on? If not, I'll create one.

from dash-bio.

mkcor avatar mkcor commented on May 24, 2024

My work-in-progress lives on branch mkcor-standalone-apps.

For the first commit on it (14b5023), I have used this nice GitHub feature: https://help.github.com/articles/creating-a-commit-with-multiple-authors/ ;)

I haven't included server = app.server in the code for the helper function, since server isn't used afterwards (tested locally that demo apps still run as standalone as expected without it).

from dash-bio.

shammamah-zz avatar shammamah-zz commented on May 24, 2024

@mkcor We need to expose the variable for the apps to run on the server. So it will work locally, but it will break once it's uploaded :)

from dash-bio.

Bachibouzouk avatar Bachibouzouk commented on May 24, 2024

@shammamah : is this issue still open?

from dash-bio.

shammamah-zz avatar shammamah-zz commented on May 24, 2024

@Bachibouzouk It shouldn't be! Fixed in #149 -- must have forgotten to close it :)

from dash-bio.

Related Issues (20)

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.