Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.
/ mercury-demo Public archive

A demo of using mercury to deploy a Jupyter notebook as a dashboard

Notifications You must be signed in to change notification settings

kevinnowland/mercury-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mercury test

This is a test of mercury, which is a way to use Jupyter notebooks as semi-interactive dashboards. It could be useful at least for showcasing a small project, as the interface which it develops is split in half, with the left side containing parameters for the notebook and the right side displaying notebook contents, either hiding the cells and just showing outputs or including the cells as well.

Running locally

  1. git clone this repository and cd into it.
  2. Install requirements in your virtual environment of choice (for me this meant running python -m venv .venv; source .venv/bin/activate; pip install -r requirements.txt).
  3. Confirm the notebook is working by running jupyter notebook and ensuring that all cells can run. Feel free to shut down the notebook, it does not have to be running for mercury to work.
  4. Add the notebook to mercury with mercury add iris-test.ipynb. Note that mercury is sort of a page of dashboards where each dashboard corresponds to a notebook, so you can run more than one notebook.
  5. Start the server with mercury runserver --runworker
  6. Go to http://127.0.0.1:8000 and click on the notebook to see that it works.

Running on heroku

We are following the instructions from this tutorial Step 0 is to create a heroku account and install the CLI.

  1. Clone this repository and cd into it.

  2. Run heroku login

  3. Run heroku create APPNAME where you fill in whatever APPNAME you want.

  4. Set heroku environment variables:

    heroku config:set SERVE_STATIC=True
    heroku config:set ALLOWED_HOSTS=APPNAME.herokuapp.com
    heroku config:set NOTEBOOKS=iris-test.ipynb
  5. run git push heroku main

  6. Start the app withheroku ps:scale web=1 and confirm the app is working by running heroku open to open the app in a browser.

  7. Shut down the running app with heroku ps:scale web=0

  8. Destroy the app with heroku apps:destroy APPNAME --confrim APPNAME.

To view logs, run heroku logs --tail.

About

A demo of using mercury to deploy a Jupyter notebook as a dashboard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published