0

Im following the Django tutorial, and ive got up to part 4. But when i went back to have a look at my admin page it mysteriously didnt work anymore. So i messed around a bit more and came up with this.

from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/(.*)', admin.site.root), #(r'^polls/', include('mysite.polls.urls')), ) 

now i can get to my admin page, but if i uncomment out the url to my views (i have another urls.py in the mysite subfolder the admin doesnt work. and it comes back with the following error.

Request Method: GET Request URL: http://192.168.0.5:9000/admin/ Exception Type: TemplateSyntaxError Exception Value: Caught an exception while rendering: Tried vote in module mysite.polls.views. Error was: 'module' object has no attribute 'vote' Original Traceback (most recent call last): File "/usr/local/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/usr/local/lib/python2.5/site-packages/django/template/defaulttags.py", line 373, in render url = reverse(self.view_name, args=args, kwargs=kwargs) File "/usr/local/lib/python2.5/site-packages/django/core/urlresolvers.py", line 254, in reverse *args, **kwargs))) File "/usr/local/lib/python2.5/site-packages/django/core/urlresolvers.py", line 227, in reverse possibilities = self.reverse_dict.getlist(lookup_view) File "/usr/local/lib/python2.5/site-packages/django/core/urlresolvers.py", line 161, in _get_reverse_dict for name in pattern.reverse_dict: File "/usr/local/lib/python2.5/site-packages/django/core/urlresolvers.py", line 169, in _get_reverse_dict self._reverse_dict.appendlist(pattern.callback, (bits, p_pattern)) File "/usr/local/lib/python2.5/site-packages/django/core/urlresolvers.py", line 136, in _get_callback raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e)) ViewDoesNotExist: Tried vote in module mysite.polls.views. Error was: 'module' object has no attribute 'vote' Exception Location: /usr/local/lib/python2.5/site-packages/django/template/debug.py in render_node, line 81 Python Executable: /usr/bin/python Python Version: 2.5.1 Python Path: ['/local/Programming/django/mysite', '/usr/lib/python2.5/site-packages/docutils-0.5-py2.5.egg', '/usr/lib/python2.5/site-packages/Pygments-1.0-py2.5.egg', '/usr/lib/python2.5/site-packages/pytz-2008i-py2.5.egg', '/usr/lib/python2.5/site-packages/Genshi-0.6dev_r999-py2.5-linux-i686.egg', '/usr/lib/python2.5/site-packages/Trac-0.11.3-py2.5.egg', '/usr/local/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg', '/usr/local/lib/python2.5/site-packages/numpy-1.3.0-py2.5-linux-i686.egg', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/PIL', '/usr/lib/python2.5/site-packages/gtk-2.0', '/usr/local/lib/python2.5/site-packages'] Server time: Sun, 24 May 2009 19:59:08 -0500 

Allso my views work fine with the admin url commented out. No errors.

Im running Django 1.0.2 final.

thanks for any help that people want to give.

Mark

2
  • Your problem is not inside urls.py > Tried vote in module mysite.polls.views. Error was: 'module' object has no attribute 'vote' How does your mysite.polls.views look like? this may help you Commented May 25, 2009 at 0:18
  • I followed that link, and indeed i was getting ahead of myself. If you finish the tutorial it all works out in the end. Commented Jun 9, 2009 at 7:49

1 Answer 1

1

Check mysite.polls.urls. It appears you have a line in that urls.py file that references a view function called vote that does not exist in mysite.polls.views.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.