I want to setup a Pubsubhubbub Subscription for my blogspot blog in Django. 
So, I started following  http://django-push.readthedocs.org package to do 
it. But it isn't working.

So, can anyone help me building a basic pubsubhubbub django project which 
subscribes and listens!



Here is what I have done:


*# views.py*

*from django.shortcuts import render_to_response*
*from django_push.subscriber.models import Subscription*
*from models import Entry*
*
*

         * # all this view does is, displays list of titles from the blog 
sent by pubsubhubbub on hub.html. *

**
*def push_hub (request):*
*    subscription = 
Subscription.objects.subscribe("http://abc.blogspot.in//feeds/posts/default";,
*
*                                                  "
http://pubsubhubbub.appspot.com/";)*
*    db = Entry.objects.all()*
*    lis = [i.title for i in db]*
*    context = {"lis" : lis}*
*    return render_to_response("hub.html", context)*

*# models.py *

from django.db import models

class Entry(models.Model):
    title = models.CharField(max_length=500)

*# mysignals.py*

from django.dispatch import receiver
from models import Entry
from django_push.subscriber.signals import updated

@receiver(updated)
def listener(notification, **kwargs):
    for entry in notification.entries:
        db = Entry ( title = entry.title )
        db.save( force_insert = True )

*# urls.py *

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


*And the project structure:*

*mysite /*
*            mysite/ urls.py , settings.py, wsgi.py ...*
*            myapp / views.py , models.py , mysignals.py ..*
*            manage.py *


Reply via email to