Getting started

  1. Add django-fitbit to your Django site’s requirements, however you prefer, and install it. It’s installable from PyPI.
  1. Add fitapp to your INSTALLED_APPS setting:

    INSTALLED_APPS += ['fitapp']
    
  2. Add the django-fitbit URLs to your URLconf:

    url(r'^fitbit/', include('fitapp.urls')),
    
  1. Register your site at the Fitbit developer site to get a key and secret.

  2. Add settings for FITAPP_CONSUMER_KEY and FITAPP_CONSUMER_SECRET:

    FITAPP_CONSUMER_KEY = '9898XH'
    FITAPP_CONSUMER_SECRET = 'abcdefg123456'
    
  3. If you need to change the defaults, add settings for FITAPP_LOGIN_REDIRECT, FITAPP_LOGOUT_REDIRECT, and/or FITAPP_ERROR_TEMPLATE.

  4. To display whether the user has integrated their Fitbit, or change a template behavior, use the is_integrated_with_fitbit template filter. Or in a view, call the fitapp.utils.is_integrated() function. You can also use the decorator fitapp.decorators.fitbit_integration_warning() to display a message to the user when they are not integrated with Fitbit.

  5. To send the user through authorization at the Fitbit site for your app to access their data, send them to the fitapp.views.login() view.

  6. To get step data for a user from a web page, use the AJAX fitapp.views.get_steps() view.

  7. If you are using sqlite, you will want to create a celery configuration that prevents the fitapp celery tasks from being executed concurrently. If you are using any other database type, you can skip this step.