8000 GitHub - meldstonerogers/cintel-07-tdash: PyShiny Template for Basic Dashboard using Penguins (adjusted for GitHub Pages)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

meldstonerogers/cintel-07-tdash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CINTEL Module 7 Project

Melissa Stone Rogers, GitHub

Tools

  • Python
  • Shiny for Python
  • VS Code + Python Extension
  • Git
  • GitHub

Try in the Browser

Go to PyShiny Templates at https://shiny.posit.co/py/templates/. Go to Dashboards / Basic Dashboard.

Reference App with Detailed Instructions

For more detailed instructions, see https://github.com/denisecase/pyshiny-penguins-dashboard-express. That project README.md has more detailed instructions, including reminders for Mac and Linux.

Get the Code

Fork this project into your own GitHub account. Clone your GitHub repo down to your local machine. GitHub CLI may work better on some machines.

git clone REPO URL

Run Locally - Initial Start

After cloning your project down to your Documents folder, open the project folder for editing in VS Code.

Create a local project virtual environment named .venv, activate it, and install the requirements.

When VS Code asks to use it for the workspace, select Yes. If you miss the window, after installing, select from the VS Code menu, View / Command Palette, and type "Python: Select Interpreter" and select the .venv folder.

Open a terminal (VS Code menu "View" / "Terminal") in the root project folder and run these commands (for Windows - the activate command is slightly different Linux/Mac).

python3 -m venv .venv
.venv\Scripts\Activate
python3 -m pip install --upgrade pip setuptools
python3 -m pip install --upgrade -r requirements.txt

Open a terminal (VS Code menu "View" / "Terminal") in the root project folder and run these commands.

shiny run --reload --launch-browser app/app.py

Open a browser to http://127.0.0.1:8000/ and test the app.

Run Locally - Subsequent Starts

Open a terminal (VS Code menu "View" / "Terminal") in the root project folder and run these commands.

python3 -m venv venv
source venv/bin/activate
shiny run --reload --launch-browser app/app.py

While the app is running, the terminal is fully engaged and cannot be used for other commands. To kill the terminal, click the trashcan icon in the VS Code terminal window.

Install required packages and dependencies into virtual enviornment

Install VS Code Extension for Shiny if you have not done so already.

Install and freeze required packages and dependencies.

pip install -r requirements.txt
python3 -m pip freeze > requirements.txt

Initial Project Save

git add .
git commit -m "initial"                         
git push origin main

Complete Project

Complete project as outlined in course content.

To incorporate Bootswatch themes, run the following:

pip install shinyswatch

And also add the import statement:

from shinyswatch import theme

After Changes, Export to Docs Folder

Export to docs folder and test GitHub Pages locally.

Open a new terminal (VS Code menu "Terminal" / "New Terminal") in the root project folder and run these commands. Remember to activate the environment first.

source venv/bin/activate
shiny static-assets remove
shinylive export app docs
python3 -m http.server --directory docs --bind localhost 8008

Open a browser to http://[::1]:8008/ and test the Pages app.

Push Changes back to GitHub

Open a terminal (VS Code menu "Terminal" / "New Terminal") in the root project folder and run these commands.

git add .
git commit -m "Useful commit message"
git push -u origin main

Enable GitHub Pages

Go to your GitHub repo settings and enable GitHub Pages for the docs folder.

About

PyShiny Template for Basic Dashboard using Penguins (adjusted for GitHub Pages)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%
0