Skip to content

Clone-able Dash Project Template πŸ’» 🐍 ⚑️ πŸŽ‰ 🀝

Notifications You must be signed in to change notification settings

sportsdatasolutions/dash_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dash App (Template)

Dash App ready to deploy to Heroku πŸ’» 🐍 ⚑️ πŸŽ‰ 🀝

DashGuide

Credit @amber-luzar - GB Hockey.

Getting Started

Use this template to create a new personal Github repo.

  1. Click Use this Template.

  2. Create your new Personal Repository from this template.

Running

Instructions for running the solution locally.

  1. Clone your repo locally.
$ git clone <github_url> dash_template
$ cd dash_template
  1. Install Pipenv (if you havn't already).
$ pip install --user pipenv
  1. Install project dependencies via requirements.txt.
$ pipenv install
  1. Serve the App.
$ pipenv run python app.py
  1. Finally, visit the local port that the app is serving on, via your browser: http://127.0.0.1:8050/.

⚠️ Quit Serving

It's good practice to manually quit serving things that are long running, e.g. when you serve the dash app, it will be running and listening on a local port until you stop serving it. If we quit the local server unexpectedly, it may block that port until we restart out machines. To quit serving simply use the control + C keys and you should see your command prompt return.

Deploying

Deploying your app to Heroku.

  1. Get ready for production! First, we'll want to create a new requirements.txt file to reflect our current project's dependencies. So we'll remove the currrent one and get pipenv to generate a new one.
$ rm requirements.txt
$ pipenv lock -r > requirements.txt
  1. Add Procfile...this file will tell Heroku how to start your Dash App with gunicorn (this should actually already be there).
web: gunicorn app:server
  1. Create a new Heroku App. Give it a name and select a relevant region (one close to you or your client).

  2. Link your Project's Github repo to your Heroku App. Be sure to enable automatic deploys once you link your Github repo. This way, every time you push new commits to your Github repo, Heroku will automatically rebuild your app with the changes.

HerokuGithub

Note: You may optionally place your app in a development pipeline. To do so, simply click the Choose a pipeline dropdown and create a new one. Create a staging and a production app. Now everytime you make changes to your app, it will be deployed to the staging app where you can test and debug your changes. When you see all is well, you can simply promote the changes to your production app, which is the one everyone will be visiting.

EnableCIHeroku

⚠️ Environment Variables

If you are using Dash Auth, make sure you are following the correct procedures for using environment variables locally and adding environment variables in Heroku. It's important you don't simply hard code the actual VALID_USERNAME_PASSWORD_PAIRS dictionary and rather get it from the Environment (wether it be locally or in Heroku)!

  1. Push your project to Github!
$ git add .
$ git commit -m "mvp"
$ git push

Note: You can watch Heroku build your app, just click view build! Otherwise, click the overview tab and wait for a deployed message.

Contributing

See contributing.md

About

Clone-able Dash Project Template πŸ’» 🐍 ⚑️ πŸŽ‰ 🀝

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published