View Snippets Error [snippet_detail.html] #15

matteius opened this Issue Dec 31, 2011 · 6 comments

3 participants


Hi, I have spent some time now configuring Django-cab to work with a new website I am developing. So far I have gotten the site mostly functional, with auth logins, and I have used the admin to create a snippet. However I have an issue with viewing the Hello World snippet.

TemplateSyntaxError at /snippets/1/
Caught UnboundLocalError while rendering: local variable 'searcher' referenced before assignment

n template /home/matteius/shared_projects/api_website/api_website/cab/templates/cab/snippet_detail.html, error at line 17
Caught UnboundLocalError while rendering: local variable 'searcher' referenced before assignment7 {% block title %}{{ object.title }}{% endblock %}

9 {% block content_header %}{{ object.title }}{% endblock %}

11 {% block content %}
12 {{ object.highlighted_code|safe }}


More like this

15 {% cache 600 mlt %}

    17 {% for related in object|more_like_this:5 %}
  1. {{ related.object.title }} by {{ }}
    19 {{ related.object.pub_date|timesince }} ago

  2. 21 {% endfor %}

23 {% endcache %}

25 {% endblock %}

27 {% block sidebar %}

/home/matteius/.virtualenvs/api_website/src/haystack/haystack/backends/ in more_like_this

I did have another issue too when I removed the offending code in the template, however just now I checked and it was resolved, possibly due to specifying a different version of the django tagit depedency, or perhaps it was missing all together. Well this is my current issue has to do with haystack search, and if I remove the offending code the snippet doesn't show up at all?!?


Actually ok, I can have the snippet show up by leaving in {{ object.description_html|safe }}

However, what isn't working for me is this code:

More like this

{% cache 600 mlt %}

    {% for related in object|more_like_this:5 %}
  1. {{ related.object.title }} by {{ }}
    {{ related.object.pub_date|timesince }} ago

  2. {% endfor %}

{% endcache %}


And Also related to this search functionality, searching gets me a template error and I do not find any information about this template:

TemplateDoesNotExist at /search/


HAYSTACK_SITECONF = 'search_sites'
HAYSTACK_SEARCH_ENGINE = 'whoosh' # Place where search indexes are stored for snippets - should be non web accessible
HAYSTACK_WHOOSH_PATH = '/tmp/search-index'

@matteius matteius closed this Dec 31, 2011

Thanks for the prompt reply. Perhaps "more like this" shouldn't be the default behavior, or there should be a setting to enable this functionality. The documentation doesn't have instructions for setting this up with anything other than woosh. Also please advise on where to look for the search templates.

@matteius matteius reopened this Dec 31, 2011
Deutscher Django-Verein e.V. member

It seems like more-like-this by now works with Whoosh and the rest of the ticket is directly related to the cab project and not to So I will close this for now :-)

@zerok zerok closed this Nov 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment