|
|
|
|
@ -15,7 +15,7 @@
|
|
|
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
|
|
|
|
from blog.models import Article, Tag, Category
|
|
|
|
|
from DjangoBlog.spider_notify import sipder_notify
|
|
|
|
|
from DjangoBlog.spider_notify import spider_notify
|
|
|
|
|
from django.contrib.sites.models import Site
|
|
|
|
|
|
|
|
|
|
site = Site.objects.get_current().domain
|
|
|
|
|
@ -35,7 +35,7 @@ class Command(BaseCommand):
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
|
type = options['data_type']
|
|
|
|
|
self.stdout.write('start get %s' % type)
|
|
|
|
|
notify = sipder_notify()
|
|
|
|
|
|
|
|
|
|
urls = []
|
|
|
|
|
if type == 'article' or type == 'all':
|
|
|
|
|
for article in Article.objects.filter(status='p'):
|
|
|
|
|
@ -50,5 +50,5 @@ class Command(BaseCommand):
|
|
|
|
|
urls.append(self.get_full_url(url))
|
|
|
|
|
|
|
|
|
|
self.stdout.write(self.style.SUCCESS('start notify %d urls' % len(urls)))
|
|
|
|
|
notify.baidu_notify(urls)
|
|
|
|
|
spider_notify.baidu_notify(urls)
|
|
|
|
|
self.stdout.write(self.style.SUCCESS('finish notify'))
|
|
|
|
|
|