Ticket #7185: ping_google.diff

File ping_google.diff, 1.4 KB (added by petershinners <pete@…>, 17 years ago)

patch

  • django/contrib/sitemaps/management/commands/ping_google.py

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

     
    317317cron script, or some other scheduled task. The function makes an HTTP request
    318318to Google's servers, so you may not want to introduce that network overhead
    319319each time you call ``save()``.
     320
     321Once the sitemaps application is added to your project, you may also
     322ping the Google server's through the command line manage.py interface::
     323
     324    python manage.py ping_google [/sitemap.xml]
     325
Back to Top