tags:

views:

2952

answers:

3

I was doing the tutorial from the book teach yourself django in 24 hours and in part1 hour 4 i got stuck on this error.

Traceback (most recent call last):

  File "C:\Python25\lib\site-packages\django\core\servers\basehttp.py", line 278, in run
    self.result = application(self.environ, self.start_response)

  File "C:\Python25\lib\site-packages\django\core\servers\basehttp.py", line 635, in __call__
    return self.application(environ, start_response)

  File "C:\Python25\lib\site-packages\django\core\handlers\wsgi.py", line 239, in __call__
    response = self.get_response(request)

  File "C:\Python25\lib\site-packages\django\core\handlers\base.py", line 67, in get_response
    response = middleware_method(request)

  File "C:\Python25\Lib\site-packages\django\middleware\common.py", line 56, in process_request
    if (not _is_valid_path(request.path_info) and

  File "C:\Python25\Lib\site-packages\django\middleware\common.py", line 142, in _is_valid_path
    urlresolvers.resolve(path)

  File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line 254, in resolve
    return get_resolver(urlconf).resolve(path)

  File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line 181, in resolve
    for pattern in self.url_patterns:

  File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line 205, in _get_url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

  File "C:\Python25\Lib\site-packages\django\core\urlresolvers.py", line 200, in _get_urlconf_module
    self._urlconf_module = __import__(self.urlconf_name, {}, {}, [''])

  File "c:\projects\iFriends\..\iFriends\urls.py", line 17, in <module>
    (r'^admin/', include('django.contribute.admin.urls'))

TypeError: 'tuple' object is not callable

Can someone help me please..

url.py

from django.conf.urls.defaults import *

####Uncomment the next two lines to enable the admin:
#### from django.contrib import admin
#### admin.autodiscover()

urlpatterns = patterns('',
    (r'^People/$', 'iFriends.People.views.index') ,
    (r'^admin/', include('django.contrib.admin.urls')), 
    # Example:
    # (r'^iFriends/', include('iFriends.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:


)
+1  A: 

You somehow set some function to a tuple. Please edit the question and paste your urls.py code, so we can point you to the error.

I can try a wild guess:

File "c:\projects\iFriends\..\iFriends\urls.py", line 17, in <module>
   (r'^admin/', include('django.contribute.admin.urls'))

This somehow tells me that you missed a comma on line 16, so:

16. (r'^/', 'some_stuff....')      # <-- missed comma here
17. (r'^admin/', include('django.contribute.admin.urls'))

Just put the comma and it will work. If that's not the case, I'll send my cristal ball for mainantance. Paste the code.

EDIT

Seems like you have pasted the urls.py as an answer. Please edit the question and paste urls.py there.

Anyway, the error has changed. What did you do? In this new error, urls.py is not found anymore so maybe you've renamed it? Have you changed the way you run the application?

The file you pasted is not the one that is running. Are you pasting url.py and django is reading urls.py? The code in the error doesn't match the code you pasted! Please paste the correct file, i.e. the same that gives the error, or we can't help.

nosklo
A: 

url.py

from django.conf.urls.defaults import *

Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover()

urlpatterns = patterns('', (r'^People/$', 'iFriends.People.views.index') , (r'^admin/', include('django.contrib.admin.urls')), # Example: # (r'^iFriends/', include('iFriends.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:

)

jazzrai
Can you delete this non-answer and update the question?
S.Lott
A: 

This book sucks, I received the same error, b/c of that damn comma they forgot to put in. This is the forth error i have found w/in the first 3 hours (chapters)