Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

TwilioDevEd/server-notifications-django

Repository files navigation

Server Notifications with Twilio and Django

Build and test Coverage Status

Use Twilio to send SMS alerts so that you never miss a critical issue.

Read the full tutorial here!

Quickstart

This project is built using the Django web framework. It runs on Python 3.6+.

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

  1. Create a new virtual environment:

    • If using vanilla with Python 3 virtualenv:

      python -m venv venv
      source venv/bin/activate
      
    • If using virtualenvwrapper:

      mkvirtualenv server-notifications-django
      
  2. Install the requirements:

    pip install -r requirements.txt
    
  3. 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)

  4. For the TWILIO_NUMBER variable you'll need to provision a new number in the Manage Numbers page under your account. The phone number should be in E.164 format

  5. (Optional) This project integrate python-dotenv to automatically load the .env file. Alternatively, you can run source .env to apply the environment variables (or even use autoenv)

  6. Customize config/administrators.json with your phone number.

  7. Start the development server

    python manage.py runserver
    
  8. Go to http://localhost:8000/error. You'll receive a text shortly with details on the exception.

Note: To enable debug logs in local environment, set the DEBUG variable to True in the local.py file

Use Production Environment

Follow previous guide and in step 3 do:

  1. Copy the .env.production.example file to .env, and edit it to include your Twilio API credentials (found at https://www.twilio.com/user/account/voice) and add the DJANGO_SECRET_KEY

Run the tests

You can run the tests locally through coverage:

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

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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy