Z
Z
Zapix2012-01-24 15:40:27
Django
Zapix, 2012-01-24 15:40:27

django-sphinx and flatpage

I'm trying to set up a search on FlatPage. To create a search field in the FlatPage model, I use the “monkey patching” technique, which I create in a separate file.

# -*- coding: utf-8 -*-
from djangosphinx.models import SphinxSearch
from django.contrib.flatpages.models import FlatPage


FlatPage.add_to_class('search', SphinxSearch(
        index='article_index',
        weights={
            'title': 100,
            'description': 30,
            'tags': 80, })



When including a patch in urls.py, the generate_sphinx_config command does not find this technique. And when connected in settings.py, it gives an error: Nobody knows what the problem is?

$ ./manage.py generate_sphinx_config --all > /home/django/projects/optimed/etc/search_index/optimed_config.conf
Error: Unable to find any models in application which use standard SphinxSearch configuration.


$ ./manage.py ./manage.py generate_sphinx_config --all > /home/django/projects/optimed/etc/search_index/optimed_config.conf
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.


Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cachealot, 2012-02-12
@cachealot

github.com/dcramer/django-sphinx has good documentation here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question