ping_google.py 402 B

12345678910111213
  1. from django.core.management.base import BaseCommand
  2. from django.contrib.sitemaps import ping_google
  3. class Command(BaseCommand):
  4. help = "Ping Google with an updated sitemap, pass optional url of sitemap"
  5. def execute(self, *args, **options):
  6. if len(args) == 1:
  7. sitemap_url = args[0]
  8. else:
  9. sitemap_url = None
  10. ping_google(sitemap_url=sitemap_url)