Skip to main content

rich media consuming/providing for django

Project description


First, you need to install OEmbed. It is available at

git clone git://
cd djangoembed
python install

Adding to your Django Project

After installing, adding OEmbed consumption to your projects is a snap. First, add it to your projects’ INSTALLED_APPs and run ‘syncdb’:


djangoembed uses a registration pattern like the admin’s. In order to be sure all apps have been loaded, djangoembed should run autodiscover() in the If you like, you can place this code right below your admin.autodiscover() bits:

import oembed

Consuming Resources

Now you’re ready to start consuming OEmbed-able objects. There are a couple of options depending on what you want to do. The most straightforward way to get up-and-running is to add it to your templates:

{% load oembed_tags %}

{% oembed %}blog.content{% endoembed %}

{# or use the filter #}

{{ blog.content|oembed }}

{# maybe you're working with some dimensional constraints #}

{% oembed "600x600" %}blog.content{% endoembed %}

{{ blog.content|oembed:"600x600" }}

You can consume oembed objects in python as well:

import oembed

# just get the metadata
resource ='')

{u'author_name': u'botmib',
 u'author_url': u'',
 u'height': 313,
 u'html': u'<object width="384" height="313"><param name="movie" value=""></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="" type="application/x-shockwave-flash" width="384" height="313" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
 u'provider_name': u'YouTube',
 u'provider_url': u'',
 u'title': u'Leprechaun in Mobile, Alabama',
 u'type': u'video',
 u'version': u'1.0',
 u'width': 384}

# get the metadata and run it through a template for pretty presentation
from oembed.consumer import OEmbedConsumer
client = OEmbedConsumer()
embedded = client.parse_text("")

<div class="oembed oembed-video provider-youtube">
  <object width="384" height="313">
    <param name="movie" value=""></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed src=""
  <p class="credit">
    <a href="">Leprechaun in Mobile, Alabama</a>
    <a href="">botmib</a>


Problem: You try the youtube embed example, but all you get is a link to the youtube video.

Solution: Djangoembed uses fixtures to load data about oembed providors like Youtube in to the database. Try fooling around with syncdb (or migrations, if you’re running South) until there are objects of type oembed.storedprovider.

If you have another problem, consider looking through the more extensive docs in the project’s doc subdirectory.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for djangoembed, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size djangoembed-0.1.1.tar.gz (114.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page