Django + AWS Elastic Transcoder

Overview

Django Elastic Transcoder

Build Status Coverage Status

django-elastic-transcoder is an Django app, let you integrate AWS Elastic Transcoder in Django easily.

What is provided in this package?

  • Transcoder class
  • URL endpoint for receive SNS notification
  • Signals for PROGRESS, ERROR, COMPLETE
  • EncodeJob model

Workflow

https://github.com/StreetVoice/django-elastic-transcoder/blob/master/docs/images/workflow.jpg

Install

First, install dj_elastictranscode with pip

$ pip install django-elastic-transcoder

Then, add dj_elastictranscoder to INSTALLED_APPS

INSTALLED_APPS = (
    ...
    'dj_elastictranscoder',
    ...
)

Bind urls.py

urlpatterns = patterns('',
    ...
    url(r'^dj_elastictranscoder/', include('dj_elastictranscoder.urls')),
    ...
)

Migrate

$ ./manage.py migrate

Setting up AWS Elastic Transcoder

  1. Create a new Pipeline in AWS Elastic Transcoder.
  2. Hookup every Notification.
  3. Subscribe SNS Notification through HTTP
  4. You are ready to encode!

Required Django settings

Please settings up variables below to make this app works.

AWS_ACCESS_KEY_ID = <your aws access key id>
AWS_SECRET_ACCESS_KEY = <your aws secret access key>
AWS_REGION = <aws region>

Usage

For instance, encode an mp3

from dj_elastictranscoder.transcoder import Transcoder

input = {
    'Key': 'path/to/input.mp3',
}

outputs = [{
    'Key': 'path/to/output.mp3',
    'PresetId': '1351620000001-300040' # for example: 128k mp3 audio preset
}]

pipeline_id = '<pipeline_id>'

transcoder = Transcoder(pipeline_id)
transcoder.encode(input, outputs)

# your can also create a EncodeJob for object automatically
transcoder.create_job_for_object(obj)


# Transcoder can also work standalone without Django
# just pass region and required aws key/secret to Transcoder, when initiate

transcoder = Transcoder(pipeline_id, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)

Setting Up AWS SNS endpoint

AWS Elastic Transcoder can send various SNS notification to notify your application, like PROGRESS, ERROR, WARNING and COMPLETE

So this package provide a endpoint to receieve these notifications, for you to update transcode progress. without checking by your self.

Go to SNS section in AWS WebConsole to choose topic and subscribe with the url below.

http://<your-domain>/dj_elastictranscoder/endpoint/

Before notification get started to work, you have to activate SNS subscription, you will receive email with activation link.

After subscribe is done, you will receive SNS notification.

Signals

This package provide various signals for you to get notification, and do more things in your application. you can check the signals usage in tests.py for more usage example.

  • transcode_onprogress
  • transcode_onerror
  • transcode_oncomplete
Comments
  • Adding missing migration.

    Adding missing migration.

    Reopened this merge request with the changes on a separate branch.

    When running make migrations for my project I noticed that an additional migration was being created for this app. The only difference that I saw between this migration and the initial migration is that the initial migration uses byte strings for the choices.

    Looking at the history for the models file it doesn't look like the state choices were ever byte strings. It looks like they were added to the migration when the migrations were changed to be compatible with Django 1.8.

    opened by trumpet2012 1
  • Adding missing migration.

    Adding missing migration.

    When running make migrations for my project I noticed that an additional migration was being created for this app. The only difference that I saw between this migration and the initial migration is that the initial migration uses byte strings for the choices.

    Looking at the history for the models file it doesn't look like the state choices were ever byte strings. It looks like they were added to the migration when the migrations were changed to be compatible with Django 1.8.

    opened by trumpet2012 1
  • fixes #8, deprecation for GenericForeignKey in Django1.9 and bump version

    fixes #8, deprecation for GenericForeignKey in Django1.9 and bump version

    This commit introduces a backward compatible import where the warning is removed for django1.8 and ensure that the project will run on Django1.9 when the support for GenericForeignKey will be removed from the generic module in contenttype.

    opened by vinitkumar 1
  • Get Django version from django.VERSION

    Get Django version from django.VERSION

    Get Django version from django.VERSION. django.get_version() is not working in Django 1.10 since either '1.10 > '1.8' or '1.10 > '1.9' is False.

    opened by Robert-Chiang 0
  • took out asserts

    took out asserts

    When running on EC2 with IAM, the boto derives the AWS_* variables from the instance itself automatically. They are not required to be set explicitly.

    opened by wgiddens 0
  • Erred Job Notifications

    Erred Job Notifications

    Notifications for jobs that had errors were breaking when the message dictionary did not contain the messageDetails key. So for jobs with errors we add the entire message dictionary to the job. This also provides us with more useful debugging information.

    opened by trumpet2012 0
  • Fixed django warning

    Fixed django warning

    Django was still throwing the Removed in Django 1.9 warning for the GenericForeignKey import in the models, if your django version was exactly 1.8. Changing the version check to be >= fixes it.

    opened by trumpet2012 0
  • Deprecation warning for GenericForeignKey

    Deprecation warning for GenericForeignKey

    RemovedInDjango19Warning: django.contrib.contenttypes.generic is deprecated and will be removed in Django 1.9. Its contents have been moved to the fields, forms, and admin submodules of django.contrib.contenttypes.
      from django.contrib.contenttypes.generic import GenericForeignKey
    

    On Django1.8, we get a deprecation warning about GenericForeignKey and it will be enforced in Django1.9

    opened by vinitkumar 0
  • Support for Django 1.3

    Support for Django 1.3

    This patch will lower the minimum supported Django version to 1.3, by modifying urls.py to import from django.conf.urls.defaults if django.conf.urls does not have url and patterns.

    As someone who is stuck at 1.3 :cry:, this is a very trivial but also very useful change.

    opened by jjmontalbo 0
  • docs: fix simple typo, receieve -> receive

    docs: fix simple typo, receieve -> receive

    There is a small typo in README.rst.

    Should read receive rather than receieve.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 0
  • Provide support for Django 2.0+

    Provide support for Django 2.0+

    What are the relevant tickets?

    fixes https://github.com/StreetVoice/django-elastic-transcoder/issues/21 we fixed it on our fork https://github.com/mitodl/django-elastic-transcoder/pull/4

    What's this PR do?

    It fix ForeignKey which requires 2 parameter from Django 2.0. But before that only one param was mandatory

    How should this be manually tested?

    Run migration with Django 2.0

    @pdpinch

    opened by amir-qayyum-khan 0
  • Getting conflict with Django==2.0.7

    Getting conflict with Django==2.0.7

    traceback (most recent call last):
      File "./manage.py", line 12, in <module>
        execute_from_command_line(sys.argv)
      File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
        utility.execute()
      File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 347, in execute
        django.setup()
      File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
        apps.populate(settings.INSTALLED_APPS)
      File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
        app_config.import_models()
      File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
        self.models_module = import_module(models_module_name)
      File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 678, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "/src/ui/models.py", line 11, in <module>
        from dj_elastictranscoder.models import EncodeJob
      File "/usr/local/lib/python3.6/site-packages/dj_elastictranscoder/models.py", line 7, in <module>
        class EncodeJob(models.Model):
      File "/usr/local/lib/python3.6/site-packages/dj_elastictranscoder/models.py", line 16, in EncodeJob
        content_type = models.ForeignKey(ContentType)
    TypeError: __init__() missing 1 required positional argument: 'on_delete'
    

    cc @pdpinch

    opened by amir-qayyum-khan 0
Owner
StreetVoice
StreetVoice
django-reversion is an extension to the Django web framework that provides version control for model instances.

django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3

Dave Hall 2.8k Jan 2, 2023
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.

Django-environ django-environ allows you to use Twelve-factor methodology to configure your Django application with environment variables. import envi

Daniele Faraglia 2.7k Jan 7, 2023
Rosetta is a Django application that eases the translation process of your Django projects

Rosetta Rosetta is a Django application that facilitates the translation process of your Django projects. Because it doesn't export any models, Rosett

Marco Bonetti 909 Dec 26, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Feldroy 10k Dec 31, 2022
Django project starter on steroids: quickly create a Django app AND generate source code for data models + REST/GraphQL APIs (the generated code is auto-linted and has 100% test coverage).

Create Django App ?? We're a Django project starter on steroids! One-line command to create a Django app with all the dependencies auto-installed AND

imagine.ai 68 Oct 19, 2022
django-quill-editor makes Quill.js easy to use on Django Forms and admin sites

django-quill-editor django-quill-editor makes Quill.js easy to use on Django Forms and admin sites No configuration required for static files! The ent

lhy 139 Dec 5, 2022
A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, celery and redis.

Django Channels Websocket Chatbot A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, c

Yunbo Shi 8 Oct 28, 2022
A handy tool for generating Django-based backend projects without coding. On the other hand, it is a code generator of the Django framework.

Django Sage Painless The django-sage-painless is a valuable package based on Django Web Framework & Django Rest Framework for high-level and rapid web

sageteam 51 Sep 15, 2022
A beginner django project and also my first Django project which involves shortening of a longer URL into a short one using a unique id.

Django-URL-Shortener A beginner django project and also my first Django project which involves shortening of a longer URL into a short one using a uni

Rohini Rao 3 Aug 8, 2021
Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot. A fully Django starter project.

Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot ?? Features A Django stater project with fully basic requirements for a production-ready

null 8 Jun 27, 2022
pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-dev 1.1k Dec 14, 2022
APIs for a Chat app. Written with Django Rest framework and Django channels.

ChatAPI APIs for a Chat app. Written with Django Rest framework and Django channels. The documentation for the http end points can be found here This

Victor Aderibigbe 18 Sep 9, 2022
django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project. Inspired in the dashboard framework Dashing

django-dashing django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project.

talPor Solutions 703 Dec 22, 2022
Django-MySQL extends Django's built-in MySQL and MariaDB support their specific features not available on other databases.

Django-MySQL The dolphin-pony - proof that cute + cute = double cute. Django-MySQL extends Django's built-in MySQL and MariaDB support their specific

Adam Johnson 504 Jan 4, 2023
Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav & ogg), which also makes it easy to play audio files into your Django application.

Django-Audiofield Description: Django Audio Management Tools Maintainer: Areski Contributors: list of contributors Django-Audiofield is a simple app t

Areski Belaid 167 Nov 10, 2022
django Filer is a file management application for django that makes handling of files and images a breeze.

django Filer is a file management application for django that makes handling of files and images a breeze.

django CMS Association 1.6k Jan 6, 2023
Twitter Bootstrap for Django Form - A simple Django template tag to work with Bootstrap

Twitter Bootstrap for Django Form - A simple Django template tag to work with Bootstrap

tzangms 557 Oct 19, 2022
Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Blog focused on skills enhancement and knowledge sharing. Tech Stack's: Vue.js, Django and Django-Ninja

Wanderson Fontes 2 Sep 21, 2022
django-idom allows Django to integrate with IDOM

django-idom allows Django to integrate with IDOM, a package inspired by ReactJS for creating responsive web interfaces in pure Python.

null 113 Jan 4, 2023