2👍
✅
Generally you will do something like this –
from django.contrib.sitemaps import Sitemap, FlatPageSitemap
sitemaps = {
'site': Sitemap,
'flatpages': FlatPageSitemap,
}
# ..
# Some url patterns. urlpatterns must be defined by now
# ..
urlpatterns += patterns("",
url(r'^sitemap\.xml$',
'django.contrib.sitemaps.views.sitemap',
{'sitemaps': sitemaps}
),
)
0👍
From the docs:
sitemaps
should be a dictionary that maps a short section label (e.g.,blog
ornews
) to itsSitemap
class (e.g.,BlogSitemap
orNewsSitemap
). It may also map to an instance of aSitemap
class (e.g.,BlogSitemap(some_var)
).
So… define it.
- [Answered ]-Store two types of value in single Django model field
- [Answered ]-Deploy bitnami django
- [Answered ]-Does Django requery every time I access a related model?
- [Answered ]-Cleaning up after a python script has been run locally vs from Django
Source:stackexchange.com