2008-07-01 20:25:59 +08:00
|
|
|
from django.contrib.sitemaps import ping_google
|
2015-01-28 20:35:27 +08:00
|
|
|
from django.core.management.base import BaseCommand
|
2008-07-01 20:25:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
2010-12-13 06:56:52 +08:00
|
|
|
help = "Ping Google with an updated sitemap, pass optional url of sitemap"
|
2008-07-01 20:25:59 +08:00
|
|
|
|
2014-09-01 18:38:08 +08:00
|
|
|
def add_arguments(self, parser):
|
2018-07-03 05:54:57 +08:00
|
|
|
parser.add_argument('sitemap_url', nargs='?')
|
2019-01-10 18:00:00 +08:00
|
|
|
parser.add_argument('--sitemap-uses-http', action='store_true')
|
2014-09-01 18:38:08 +08:00
|
|
|
|
2014-10-19 23:23:50 +08:00
|
|
|
def handle(self, *args, **options):
|
2019-01-10 18:00:00 +08:00
|
|
|
ping_google(
|
|
|
|
sitemap_url=options['sitemap_url'],
|
|
|
|
sitemap_uses_https=not options['sitemap_uses_http'],
|
|
|
|
)
|