Skip to content

ImScientist/plotly-web-app

Repository files navigation

plotly web app

Setup

  • Create an environment and install the required dependencies:

    conda create -n plotly-web-app python=3.8 -y
    conda activate plotly-web-app
    pip install -r requirements.txt
    pip install -e .
  • Local test of the app:
    Dash uses Flask as the web framework. The underlying Flask app is available at app.server

    export FLASK_APP=app:server
    flask run
  • Speed up the app
    You have probably noticed that figures do not update instantly when you change some parameters. Instead of splitting the data, calculating the roc-auc scores, generating and plotting the new figures for every change in the data splitting parameters, we can generate, dump and load all possible figures and roc-auc scores.

    Generate the content by executing:

    python create_content.py

    This content is used in app_2.py:

    export FLASK_APP=app_2:server
    flask run

Deployment

Azure Web app deployment notes (do not use this service)

  • In web-app -> Configuration -> General settings set the startup command to gunicorn -b 0.0.0.0 app_2:server or to gunicorn -b 0.0.0.0 app:server depending on what you want to run.

Use google app engine (do not use this service)

  • Create a app.yaml that contains info about the runtime and about the entrypoint. Then use the gcloud cli:
    gcloud init
    # go into the right project
    gcloud app deploy ./app.yaml -Y

Use a docker image running on ubuntu VM

  • Build the image:
    In case you want to deploy the app somewhere else:
    docker build -t plotly_app:1.0 . --build-arg runtime_path="."
    Launch a container to test the app:
    docker run --rm --name dash_app -d -p 80:80 plotly_app:1.0
    If everything is fine, add the image to the dockerhub container registry:
      docker login -u "$DOCKER_HUB_USR" \
                   -p "$DOCKER_HUB_PWD"
      
      docker tag plotly_app:1.0 "${DOCKER_HUB_USR}"/plotly_app:1.0
      
      docker push "${DOCKER_HUB_USR}"/plotly_app:1.0
  • Setup a ubuntu machine to run the docker container:
    chmod +x vm_docker_setup.sh
    ./vm_docker_setup.sh  

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published