I am starting off with django and decided to stick with the "django
book"
The webserver initiates just fine, and i made the first example: return
current time when requested the URL: /now/
It returns the following error when requesting the url:
Traceback (most recent call last):
File "d:\webdev\python\django\core\handlers\base.py" in get_response
65. callback, callback_args, callback_kwargs = resolver.resolve(path)
File "d:\webdev\python\django\core\urlresolvers.py" in resolve
145. for pattern in self.urlconf_module.urlpatterns:
File "d:\webdev\python\django\core\urlresolvers.py" in
_get_urlconf_module
161. self._urlconf_module = __import__(self.urlconf_name, '', '',
[''])
ImportError at /now/
No module named py
The path to d:\webdev\python is just fine and the welcome screen
displays just fine.
I now have a AttributeError at /now/ error
Exception Value: 'function' object has no attribute 'rindex'
Traceback (most recent call last):
File "d:\webdev\python\django\core\handlers\base.py" in get_response
65. callback, callback_args, callback_kwargs = resolver.resolve(path)
File "d:\webdev\python\django\core\urlresolvers.py" in resolve
147. sub_match = pattern.resolve(new_path)
File "d:\webdev\python\django\core\urlresolvers.py" in resolve
112. self.func = self.get_callback()
File "d:\webdev\python\django\core\urlresolvers.py" in get_callback
116. mod_name, func_name = get_mod_func(self.callback)
File "d:\webdev\python\django\core\urlresolvers.py" in get_mod_func
23. dot = callback.rindex('.')
AttributeError at /now/
'function' object has no attribute 'rindex'
The urls.py looks like this:
from django.conf.urls.defaults import *
from mysite.timeview import current_datetime
urlpatterns = patterns('',
(r'^now/$', current_datetime),
)
The current_datetime function is defined in timeview.py in the same
folder
Something like this...
urlpatterns = patterns('', ('/something or other',
'mysite.timeview.current_datetime'),)
Tone
I have a sneaking suspicion that you are trying to `import
somefile.py`. When importing in your python code, the `.py` file
extension is assumed, so leave if off: `import somefile`.
If that's not it, post your urls.py file here so we can see what may
be causing the problem.
>
>
> The path to d:\webdev\python is just fine and the welcome screen
> displays just fine.
>
>
> >
>
--
----
Waylan Limberg
way...@gmail.com
Just one thing... you are supposed to show me the general direction,
not to solve my problems with complete code included.
How will i ever learn? ;-)
If you were a pretty girl, i'd kiss you. Come to speak of it, I would
do just that with any pretty girl.
Well you get the general idea, i am greatful.