Giter Club home page Giter Club logo

django-twilio-sms-models's Introduction

django-twilio-sms-models

https://badge.fury.io/py/django-twilio-sms-models.png https://travis-ci.org/cfc603/django-twilio-sms-models.png?branch=master https://codecov.io/github/cfc603/django-twilio-sms-models/coverage.svg?branch=master

Django models for Twilio's Programmable SMS

Documentation

The full documentation is at https://django-twilio-sms-models.readthedocs.org.

Quickstart

Install django-twilio-sms-models:

$ pip install django-twilio-sms-models

Follow django-twilio install instructions:

http://django-twilio.readthedocs.org/en/latest/install.html

Add 'django-twilio-sms' to your INSTALLED_APPS:

# project/settings.py
INSTALLED_APPS = (
    ...
    'django_twilio_sms',
)

Set 'DJANGO_TWILIO_SMS_SITE_HOST' setting:

This is used to build an absolute URI for the callback url. Can also be used with ngrok on your development machine.

# project/settings.py
DJANGO_TWILIO_SMS_SITE_HOST = 'www.example.com'

Include django-twilio-sms URLconf in your project urls.py:

url(r'^twilio-integration/', include('django_twilio_sms.urls', namespace='django_twilio_sms')),

Sync the database:

$ python manage.py migrate

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements-test.txt
(myenv) $ python runtests.py

Credits

Tools used in rendering this package:

django-twilio-sms-models's People

Stargazers

Jonathan Barratt avatar  avatar Bartosz Tkaczewski avatar

Watchers

James Cloos avatar Trevor Watson avatar  avatar

Forkers

mrphishxxx

django-twilio-sms-models's Issues

Response settings

Currently the only way to setup response messages is through entries to the Action & Response models. For more complex systems, this is probably the best setup, however for quick sites, it may be best to have a setting such as the following:

DJANGO_TWILIO_SMS_RESPONSES = {
    'STOP': 'Your request to stop messages has been received.',
    'START': 'Your request to receive messages has been received.',
    ...
}

No response for unsubscribed numbers

If DJANGO_TWILIO_SMS_RESPONSE_MESSAGE = True and a phone number has been unsubscribed by Twilio a TwilioRestException is raised with the following message "The message From/To pair violates a blacklist rule."

Need to implement an internal subscription list of unsubscribed numbers which checked against for sending a response message.

InconsistentMigrationHistory for new projects

I haven't figured out how to solve this yet but thought I'd go ahead and report it. For new projects using this app, Django is confused about the DB migrations and ends up throwing InconsistentMigrationHistory.

Steps:

  1. Create new Django Project. I used Django 1.10.
  2. pip install django-twilio-sms-models
  3. Add 'django_twilio' and 'django_twilio_sms_models' to INSTALLED_APPS
  4. Add required settings like TWILIO_ACCOUNT_SID
  5. Run ./manage.py migrate to configure
  6. Run ./manage.py makemigrations to see error

Error:

django.db.migrations.exceptions.InconsistentMigrationHistory: Migration django_twilio_sms.0002_auto_20160512_2117 is applied before its dependency django_twilio_sms.0001_squashed_0005_auto_20160410_1948 on database 'default'.

Running ./manage.py showmigrations shows the first, squashed migration is skipped somehow: (trimmed some built-in models output)

django_twilio
[X] 0001_initial
django_twilio_sms
[ ] 0001_squashed_0005_auto_20160410_1948 (5 squashed migrations)
[X] 0002_auto_20160512_2117

I don't understand how it's bypassing 0001_squashed... But that prevents any DB migrations in the entire project since Django is confused. It both considers it not run but also apparently not important enough to run.

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.