PyPI version Downloads

Create and modify static Twilio TwiML views in Django


Often when building Twilio apps with Django, you want to quickly create a few simple static TwiML documents. You can usually do this by writing a view and connecting it to a URL endpoint on your Django app.

But what if you wanted to modify those documents quickly later on? Or perhaps you don't have the means to push the updates to the live server straight away?

dj-twiml lets you create and modify static TwiML documents in seconds, with a publicly addressable URL and correct XML formatting / validation.

This is perfect if you want static TwiML documents that do not require any computation, but might need modifying occassionally.


  • Install dj-twiml
    $ pip install dj-twiml
  • Add dj-twiml and django-twilio to your installed apps in settings. Add the settings for django-twilio.


    # Set this to True in production
  • Dj-twiml will install django_twilio for you, but you will also need to follow the django-twilio installation instructions too.

  • After setting up django-twilio, add the URL routing to your URLconf (

    urlpatterns = patterns(
        url(r'twiml/', include('dj_twiml.urls')),

Finally, you can run the following command on Django 1.7 and Django 1.6 (with South installed) to setup the dj_twiml database models:

    $ python migrate dj_twiml


  1. Create a new TwiML document through the admin panel (/admin/dj_twiml/twiml/)

Django admin panel

  1. Save it and test it out by sending a HTTP POST request to the new URL. The unicode name of the object will show the URL:

TwiML output

  1. Point a Twilio phone number to the new dj-twiml snippet:

Twilio phone number page

(Get a new Twilio trial account here.)

  1. Ring it! Try calling +442030952720 (UK) or +1 844-707-9437 (USA) now :)


  • Quickly build new or modify existing static TwiML snippets.

  • Supports both Django 1.7 and Django 1.6

  • Built on top of django_twilio.