django url templatetag无法撤消url

时间:2011-12-11 21:48:38

标签: django facebook django-templates django-facebook

我正在使用django-facebook并且由于一些奇怪的原因它停止了工作。 当然,我改变了一些东西,某处发生了。但是你可能已经猜到我现在一无所知。

我收到错误消息:

TemplateSyntaxError at /facebook/connect/

Caught TypeError while rendering: unhashable type: 'dict'

 Method:    GET
 Request URL:   http://dev.wiespeeltwaar.be/facebook/connect/
 Django Version:    1.3
 Exception Type:    TemplateSyntaxError
 Exception Value:   

 Caught TypeError while rendering: unhashable type: 'dict'

 Exception Location:    /home/jonasg/django-wiespeeltwaar/django/utils/functional.py in wrapper, line 22
 Python Executable:     /home/jonasg/.virtualenvs/wiespeeltwaar/bin/python
 Python Version:    2.6.6
 Python Path:   

 ['/home/jonasg/dev/wiespeeltwaar',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg',
  '/home/jonasg/django-wiespeeltwaar',
  '/home/jonasg/dev/wiespeeltwaar',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/plat-linux2',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/lib-tk',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/lib-old',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/lib-dynload',
  '/usr/lib/python2.6',
  '/usr/lib/python2.6/plat-linux2',
  '/usr/lib/python2.6/lib-tk',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages']

 Server time:   zon, 11 Dec 2011 22:41:03 +0100
 Template error

 In template /home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django_facebook/templates/django_facebook/connect.html, error at line 87

 86     <!--form to call registration via facebook -->
 87     <form action="{% url facebook_connect %}?facebook_login=1" method="post">
 88     <h2>Register, login or connect with facebook</h2>

由于某种原因,网址模板标签无法提供facebook_connect视图的网址。

感谢任何帮助!

2 个答案:

答案 0 :(得分:2)

错误实际上不在url标记中,只是该标记导致导入有问题的代码。在某处你试图使用字典作为字典键。

答案 1 :(得分:0)

在代码中的某处,这是一个相当难以调试的。

查看堆栈跟踪:

/home/jonasg/django-wiespeeltwaar/django/utils/functional.py in wrapper

if mem_args in cache:

    ...

▼ Local vars
Variable    Value
mem_args    

({'backend': 'wiespeeltwaar.accounts.backends.WswBackend',
  'form_class': <class 'registration.forms.RegistrationFormUniqueEmail'>},)

args    

({'backend': 'wiespeeltwaar

.accounts.backends.WswBackend',
  'form_class': <class 'registration.forms.RegistrationFormUniqueEmail'>},)

num_args    

1

cache   

{('api.views.add_loved',): <function add_loved at 0xa2bf1b4>,
 ('api.views.del_loved',): <function del_loved at 0xa2bf294>,
 ('api.views.details',): <function details at 0xa2bf064>,
 ('api.views.get_concerts',): <function get_concerts at 0xa2bf304>,
 ('api.views.loved',): <function loved at 0xa2bf17c>,
 ('api.views.search_artist',): <function search_artist at 0xa2befb4>,
 ('api.views.search_gig',): <function search_gig at 0xa2bf2cc>,
 ('api.views.set_notify_methods',): <function set_notify_methods at 0xa2bf224>,
 ('django.views.static.serve',): <function serve at 0x9b57b1c>,
 (u'facebook_connect',): 'facebook_connect',
 ('wiespeeltwaar.accounts.views.add_favartist',): <function add_favartist at 0xa2bfa3c>,
 ('wiespeeltwaar.accounts.views.del_favartist',): <function del_favartist at 0xa2bfaac>,
 ('wiespeeltwaar.accounts.views.profile',): <function profile at 0xa2bfa74>,
 ('wiespeeltwaar.gig.views.index',): <function index at 0x9f9ea3c>}

func    

<function get_callable at 0x9aba2cc>

似乎我发现事情发生了可怕的错误。  (u'facebook_connect',):'facebook_connect', 这条线看起来并不正确!