Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dash Bio apps need to be moved to dash-bio.plotly.host #133

Closed
2 of 6 tasks
shammamah-zz opened this issue Jan 25, 2019 · 11 comments
Closed
2 of 6 tasks

Dash Bio apps need to be moved to dash-bio.plotly.host #133

shammamah-zz opened this issue Jan 25, 2019 · 11 comments
Assignees

Comments

@shammamah-zz
Copy link
Contributor

shammamah-zz commented Jan 25, 2019

In accordance with https://github.com/plotly/streambed/issues/12263, we are making our index.py app obsolete. The applications we currently have are not true standalone apps, since they just modify the layout on the main index.py app. Right now, index.py lives on that server (https://dash-gallery.plotly.host/dash-bio) and its portal (https://dash-bio.plotly.host/Portal/)

What we need to do:

  • Publish the dash bio package to test.pypi.org
  • Separate the requirements for each app from our requirements.txt file, add in the dash_bio dependency
  • Set up a file structure within the repository that will house all of the applications. I'm thinking just a folder called demo_apps that contains a folder for each app
  • Copy each app's relevant sample_data files into its folder
  • Create all the necessary files (looks like we need a config.py and runtime.txt) for each app in its folder
  • Once the apps are on the portal, tag them (this looks like a really cool feature we should take advantage of!) with things like "genomics", "visualizations", etc.

Let's get this done before I fly out to Boston for training with Amgen (13 Feb)! They're a huge pharmaceutical company and it would be awesome to show off Dash Bio and sell them on DDS simultaneously :) let's get that 🍞

@shammamah-zz
Copy link
Contributor Author

shammamah-zz commented Jan 25, 2019

@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 :)

@Bachibouzouk
Copy link
Contributor

@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 :)

@shammamah-zz
Copy link
Contributor Author

shammamah-zz commented Jan 25, 2019

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

@mkcor
Copy link
Contributor

mkcor commented Jan 28, 2019

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

@Bachibouzouk
Copy link
Contributor

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

@mkcor
Copy link
Contributor

mkcor commented Jan 29, 2019

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 :(

@mkcor
Copy link
Contributor

mkcor commented Jan 29, 2019

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).

@shammamah-zz
Copy link
Contributor Author

@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 :)

@mkcor
Copy link
Contributor

mkcor commented Jan 29, 2019

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

@Bachibouzouk
Copy link
Contributor

@shammamah : is this issue still open?

@shammamah-zz
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants