Git Product home page Git Product logo

fitgoal's Introduction

Fitgoal Intro


Tracks total distance covered by Fitbit user in this year using simple graphs. Activities to track can be selected by the user.

Setup


These instructions are for deploying your own version of this app. For normal use, you can just use the website.

Local

  • Init a virtual environment python3 -m venv env
  • Install autoenv pip install autoenv==1.0.0
  • Activate virtual environment and variables cd . or source .env
  • Install dependencies in virtual environment pip install -r requirements.txt
  • (Optional) Install Redis, if you want to test subscriptions locally. On Mac run brew install redis

Heroku (optional)

Below steps are required only if you want to deploy the app to Heroku.

  • Install Heroku cli and login
  • Create a Heroku app heroku create HEROKU-APP-NAME (pick your app name)
  • Set deploy configuration heroku config:set APP_SETTINGS=config.StagingConfig
  • Enable Redis heroku addons:create heroku-redis:hobby-dev

Fitbit

Create a Fitbit app with below values.

  • OAuth 2.0 Application Type: Server
  • Callback URL:
http://localhost:5000/account/edit
http://HEROKU-APP-NAME.herokuapp.com/auth
https://HEROKU-APP-NAME.herokuapp.com/auth
  • Add a subscriber (only for heroku or remote deployments)
Default
Endpoint URL: https://HEROKU-APP-NAME.herokuapp.com/update
Type: JSON Body
Subscriber ID: 1
  • For local setup, create a file named .secrets with following template and values of your Fitbit app
export FITBIT_APP_ID="OAuth 2.0 Client ID"
export FITBIT_APP_SECRET="Client Secret"
  • For heroku setup, run following commands using values of your Fitbit app
heroku config:set FITBIT_APP_ID="OAuth 2.0 Client ID"
heroku config:set FITBIT_APP_SECRET="Client Secret"
heroku config:set FITBIT_VERIFICATION_CODE="Subscriber Verification Code"

Setup Database

  • Install Postgres and open Postgres shell psql
  • Create a database create database fitgoal; and exit \q
  • Setup local database python manage.py db upgrade
  • Enable Postgres on Heroku heroku addons:create heroku-postgresql:hobby-dev
  • Setup heroku database heroku run python manage.py db upgrade

Running


Locally

  • Execute python app.py
  • (Optional) Do these only if you want to test Subscriptions locally
    • Start Redis server in a new terminal redis-server
    • Start worker in a new terminal python worker.py

Heroku

  • Push code to Heroku git push heroku
  • Verify Subscribers endpoint from your Fitbit app's page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.