title: django sitemap http://example.com
body: <p>Sorry for my bad english but i'm not english!</p>
  
  <p>I try to generate a sitemap.xml with my django project.</p>
  
  <p>In my project i don't have models (my database is empty), i have just static url (like 'home' or 'About' ).</p>
  
  <p>I succeded to generate a sitemap.xml but i have "<a href="http://example.com" rel="noreferrer">http://example.com</a>" instead that my domain name.</p>
  
  <p>This is my sitemap.xml:</p>
  
  <pre><code>&lt;urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;
  &lt;url&gt;
  &lt;loc&gt;
  http://example.com/accueil
  &lt;/loc&gt;
  &lt;lastmod&gt;
  2013-03-14
  &lt;/lastmod&gt;
  &lt;changefreq&gt;
  weekly
  &lt;/changefreq&gt;
  &lt;/url&gt;
  &lt;url&gt;
  &lt;loc&gt;
  http://example.com/cv
  &lt;/loc&gt;
  &lt;lastmod&gt;
  2013-03-14
  &lt;/lastmod&gt;
  &lt;changefreq&gt;
  weekly
  &lt;/changefreq&gt;
  &lt;/url&gt;
  &lt;url&gt;
  &lt;loc&gt;
  http://example.com/portfolio
  &lt;/loc&gt;
  &lt;lastmod&gt;
  2013-03-14
  &lt;/lastmod&gt;
  &lt;changefreq&gt;
  weekly
  &lt;/changefreq&gt;
  &lt;/url&gt;
  &lt;url&gt;
  &lt;loc&gt;
  http://example.com/a_propos
  &lt;/loc&gt;
  &lt;lastmod&gt;
  2013-03-14
  &lt;/lastmod&gt;
  &lt;changefreq&gt;
  weekly
  &lt;/changefreq&gt;
  &lt;/url&gt;
  &lt;/urlset&gt;
  </code></pre>
  
  <p>and my urls.py:</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from django.conf import settings
  from django.contrib.staticfiles.urls import staticfiles_urlpatterns
  from django.conf.urls.static import static
  
  from sitemaps import BasicSitemap
  # Uncomment the next two lines to enable the admin:
  # from django.contrib import admin
  # admin.autodiscover()
  
  sitemaps= {
      'pages' : BasicSitemap(['accueil','cv','portfolio','apropos'])
  }
  
  urlpatterns = patterns('',
      # Examples:
      # url(r'^$', 'portfolio.views.home', name='home'),
      # url(r'^portfolio/', include('portfolio.foo.urls')),
  
      # Uncomment the admin/doc line below to enable admin documentation:
      # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
  
      # Uncomment the next line to enable the admin:
      # url(r'^admin/', include(admin.site.urls)),
      url(r'^', include('portail_portfolio.urls')),
      url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps})
  </code></pre>
  
  <p>)</p>
  
  <pre><code>urlpatterns += staticfiles_urlpatterns() + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  
  <p>And my sitemaps.py:</p>
  
  <pre><code>from django.contrib.sitemaps import Sitemap
  from django.core.urlresolvers import reverse
  #from portail_portfolio.models import Entry
  
  from datetime import datetime
  
  class BasicSitemap(Sitemap):
  
      def __init__(self, names):
          self.names = names
  
      def items(self):
          return self.names
  
      def changefreq(self, obj):
          return 'weekly'
  
      def lastmod(self, obj):
          return datetime.now()
  
      def location(self,obj):
          return reverse(obj)
  </code></pre>
  
  <p>I hope you can understand my english and i hope you can help me!</p>
  
  <p>Cordially,</p>
  
  <p>sushi</p>