Search code examples
djangodjango-haystackwhoosh

Django Haystack and Woosh not working on web requests but working on django shell on production server


On my production server, I'm not getting any search results with haystack when I search through the webpage, but it builds indexes correctly and I can retrieve results using the haystack api on the django shell.

No exceptions are being thrown, I just get no results at all.

On my local server everything works fine.

The only discernible difference is that the production server is using fcgi where as the local server is using wsgi.

I can't for the life of me figure out what's going on. Any ideas?


Solution

  • I resolved the issue by owning the search index directory to apache and moving:

    import haystack
    haystack.autodiscover()
    

    from search_sites.py to urls.py

    I still don't fully understand why the search is now working but I'm glad it is!