When I try to run the example program, I get a page full of errors,
with this heading:
---
AttributeError at /now/
'function' object has no attribute 'rindex'
Request Method: GET
Request URL: http://127.0.0.1:8000/now/
Exception Type: AttributeError
Exception Value: 'function' object has no attribute 'rindex'
Exception Location: /var/lib/python-support/python2.4/django/core/
urlresolvers.py in get_mod_func, line 23
---
The problem seems t be in line 23 of urlresolvers.py.
---
23 dot = callback.rindex('.')
---
Apparently, there is some problem with the "rindex" attribute.
I am brand new to Django. I have no idea what to do about this. Is
this a bug? Or did I do something wrong?
http://notkeepingitreal.com/articles/category/django
According to the blog on that site, parameter in urls.py needs to be
changed from:
(r'^now/$', current_datetime),
To:
(r'^now/$', 'survey.views.current_datetime'),
I tried that, and it still didn't work. Then I changed the parameter
to:
(r'^now/$', 'views.current_datetime'),
And it worked.
The blog on that site was written last January. Numerous other errors
were cited. If these are known problems, that have been around that
long, that's pretty bad.
JMHO.
I think you're using an old version of Django. The latest stable is
0.96. Please update to that.
That's only necessary due to the old Django version.
> I tried that, and it still didn't work. Then I changed the parameter
> to:
>
> (r'^now/$', 'views.current_datetime'),
This is due to your local python path. The string given there is an
import path, and if you can't import 'survey' from regular python,
Django won't be able to either. Consider adding the parent directory
of 'survey' to your python path.