如何在Django PuSH中创建回调URL

时间:2012-09-19 13:29:59

标签: python django django-views django-signals pubsubhubbub

我在Blogger博客中使用Django-PuSH(PubSubHubPub)。

现在,我阅读了文档,可以编写简单的代码。但是,该文档从未提及任何地方输入回调网址!

这是简单的代码。

# hubserver.py
@receiver(updated)
def listener(notification, **kwargs):
    e = []
    for entry in notification.entries:
        e.append(entry.title)

    for link in e:
        db = entries( url = link )
        db.save(force_insert=True)


from django.shortcuts import render_to_response
from django_push.subscriber.models import Subscription
from models import mydata

# views
def bloghub (request):
    subscription = Subscription.objects.subscribe("http://myblog.blogspot.in//feeds/posts/default",
                                                  "http://pubsubhubbub.appspot.com")
    db = mydata.objects.all()
    lis = [i.url for i in db]
    context = {"lis" : lis}
    return render_to_response("home.html", context)


  [1]: http://django-push.readthedocs.org

# urls.py
urlpatterns = patterns('',
                       url(r'^$', views.bloghub ),
                       url(r'^subscriber/', include('django_push.subscriber.urls')),

)

0 个答案:

没有答案