/appointment-reminders-django

A working Appointment Reminders sample built in Django

Primary LanguagePythonMIT LicenseMIT

Appointment Reminders (Django)

Build Status

Use Twilio to create automatic appointment reminders for your business's clients.

Read the full tutorial here!

Quickstart

Heroku

This project is preconfigured to run on Heroku. Deploy it now:

Deploy

To start the Celery worker process, which sends the SMS reminders asynchronously, you need to change a few settings in your Heroku dashboard:

  1. After the app deploys, click the Manage app button to view this app's settings
  2. Click Edit in the top right corner of the dashboard
  3. Change the app to use Free pricing - the first option
  4. Click the toggle for the worker process, enabling it for free pricing
  5. Click Save in the top right corner

Now you're all set.

To view your app, click the ... menu in the top right corner and select Open app.

Local development

This project is built using the Django web framework. It runs on Python 2.7+ and Python 3.4+.

To run the app locally, first clone this repository and cd into its directory. Then:

  1. Create a new virtual environment:
    • If using vanilla virtualenv, run virtualenv venv and then source venv/bin/activate
    • If using virtualenvwrapper, run mkvirtualenv appointments
  2. Install the requirements with pip install -r requirements.txt
  3. Start a local PostgreSQL database and create a database called appointment_reminders
    • If on a Mac, I recommend Postgres.app. After install, open psql and run CREATE DATABASE appointment_reminders;
    • If Postgres is already installed locally, you can just run createdb appointment_reminders from a terminal
  4. Run the migrations with python manage.py migrate
  5. Optionally create a superuser so you can access the Django admin: python manage.py createsuperuser
  6. Copy the .env_example file to .env, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice)
  7. Run source .env to apply the environment variables (or even better, use autoenv)
  8. Start the development server: python manage.py runserver

This project uses Celery to asynchronously send SMS reminders to users. To start the Celery process:

  1. This project uses Redis as its task queue. Install and start Redis
  2. Start a new terminal session and activate your virtual environment
  3. Source the .env file if you're not using autoenv
  4. Start the Celery worker with the command: celery -A appointments.settings worker -l info

You can then visit the application at http://localhost:8000/.

Run the tests

You can run the tests locally through coverage:

$ coverage run manage.py test --settings=appointments.settings.test

You can then view the results with coverage report or build an HTML report with coverage html.