On Sat, Apr 11, 2009 at 4:16 PM, Johann Spies <johann.sp...@gmail.com>wrote:

>
> Working through the tutorial everything went well until I came to the
> section "Decoupling the URLconfs" where
> the "include" option for urls in a subdirectory is not working as
> advertised.
>
> What did I do wrong?
>
>
> In mysite/urls.py I have:
>
> ==========================================
> from django.conf.urls.defaults import *
>
> (r'^polls/', include('mysite.polls.urls')),
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
> =================================
> And in mysite/polls/urls.py  have
> =====================================
> from django.conf.urls.defaults import *
>
> urlpatterns = patterns('mysite.polls.views',
>    (r'^$', 'index'),
>    (r'^(?P<poll_id>\d+)/$', 'detail'),
>    (r'^(?P<poll_id>\d+)/results/$', 'results'),
>    (r'^(?P<poll_id>\d+)/vote/$', 'vote'),
> )
> =========================================
> But this results in:
>
> Traceback (most recent call last):
>
>  File "/var/lib/python-support/python2.6/django/core/servers/basehttp.py",
> line 278, in run
>    self.result = application(self.environ, self.start_response)
>
>  File "/var/lib/python-support/python2.6/django/core/servers/basehttp.py",
> line 635, in __call__
>    return self.application(environ, start_response)
>
>  File "/var/lib/python-support/python2.6/django/core/handlers/wsgi.py",
> line 239, in __call__
>    response = self.get_response(request)
>
>  File "/var/lib/python-support/python2.6/django/core/handlers/base.py",
> line 67, in get_response
>    response = middleware_method(request)
>
>  File "/var/lib/python-support/python2.6/django/middleware/common.py",
> line 56, in process_request
>    if (not _is_valid_path(request.path_info) and
>
>  File "/var/lib/python-support/python2.6/django/middleware/common.py",
> line 142, in _is_valid_path
>    urlresolvers.resolve(path)
>
>  File "/var/lib/python-support/python2.6/django/core/urlresolvers.py",
> line 246, in resolve
>    return get_resolver(urlconf).resolve(path)
>
>  File "/var/lib/python-support/python2.6/django/core/urlresolvers.py",
> line 179, in resolve
>    for pattern in self.urlconf_module.urlpatterns:
>
> AttributeError: 'module' object has no attribute 'urlpatterns'
>
>
> Regards.
>
> Johann
>
> >
>
mysite/urls.py needs to have the full urlpatterns = thing like the
polls/urls.py has so it would look like:

from django.conf.urls.defaults import *

admin.autodiscover()

urlpatterns = patterns('',
     (r'^polls/', include('mysite.polls.urls')),
)



Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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