My favorites | Sign in
Project Home Wiki Issues Source
Search
for
Sitemaps  
Using django.contrib.sitemaps with appengine django helper
Updated May 13, 2010 by dherbst

Introduction

Until the main appengine django helper project integrates the changes for the sites and sitemaps ticket, you can use this fork to use Django sitemaps in your AppEngine project.

Details

  1. Install this fork
  2. Modify settings.py to enable sites and sitemaps:
  3. INSTALLED_APPS = {
       'appengine_django',
        ...
       'django.contrib.sites',
       'django.contrib.sitemaps',
       
  4. in urls.py add the following:
  5. from myapp.sitemaps import MySitemap
    
    sitemaps = { 'mysitemap': MySitemap, }
    
    urlpatterns = ...
        (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
    
  6. MySitemap should look like the following:
  7. from django.contrib.sitemaps import Sitemap
    
    class MySitemap(Sitemap):
        changefreq = 'daily'
        priority = 0.5
        def items(self):
            return MyModel.all()
        def lastmod(self,obj):
            return obj.mod_datetime
  8. Also be sure your model implements get_absolute_url
  9. visit /sitemap.xml and you should see your sitemap

Sign in to add a comment
Powered by Google Project Hosting