Anyone???

On Sun, Dec 16, 2012 at 8:25 PM, Frankline <fraogo...@gmail.com> wrote:

> I'm having a problem implementing the sitemaps in my application. I'm
> using Virtualenv, django 1.4 and Python 2.7. I would appreciate if you
> can help me resolve this.
>
> This is what I have done:
>
> 1. In my *urls.py*
>
> from sitemap import JobPostSitemap
> sitemaps = {
>     'jobs': JobPostSitemap,
> }
> ... # Removed other urls
> url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
> {'sitemaps': sitemaps}),
>
> 2. Then in my *sitemap.py* file
>
> from django.contrib.sitemaps import Sitemap
> from jobs.models import JobPost
>
> class JobPostSitemap(Sitemap):
>     changefreq = "never"
>     priority = 0.5
>
>     def items(self):
>         return JobPost.objects.filter(approved=True)
>
>     def lastmod(self, obj):
>         return obj.pub_date
>
>
> 3. My *settings.py* file is as follows:
>
> ...
> INSTALLED_APPS = (
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.sites',
>     'django.contrib.messages',
>     'django.contrib.staticfiles',
>     'django.contrib.sitemaps',
>     'jobs',
> )
> ...
>
> Now when I open my browser and navigate to *http://localhost**
> :8000/sitemap.xml* , I get the following error:
>
>
> ImportError at /sitemap.xml
>
> No module named django.contrib.sitemaps
>
>  Request Method: GET  Request URL: http://localhost:8000/sitemap.xml  Django
> Version: 1.4.2  Exception Type: ImportError  Exception Value:
>
> No module named django.contrib.sitemaps
>
>  Exception Location: /home/frank/Projects/python/django/
> techjobsea.com/baseline27/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/utils/importlib.pyin
>  import_module, line 35  Python
> Executable: /home/frank/Projects/python/django/
> techjobsea.com/baseline27/bin/python  Python Version: 2.7.3

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to