Dear all

django 1.8
python 3.4

The sqlite function sqlite-Levenshtein 
(https://github.com/mateusza/SQLite-Levenshtein) is working perfectly in 
the django shell, example: 
self.annotate(distance=Func(Value(aword), F('word'), function='levenshtein'
)).filter(distance__lte=settings.DISTANCE_LEVENSHTEIN).order_by("distance")

but not with runserver : "no such function: levenshtein"

I load this extension in my app __init__.py as follow:

from mezzanine.conf import settings
# levenshtein exists in postgresql, sqlite needs extension
if 'sqlite3' in settings.DATABASES['default']['ENGINE']:
    from django.db import connection
    cursor =connection.cursor()
    cursor.db.connection.enable_load_extension(True)
    cursor.db.connection.load_extension(settings.SQLITE_LEVENSHTEIN) 


with settings.SQLITE_LEVENSHTEIN = 
="/usr/local/src/sqlite-Levenshtein/src/.libs/liblevenshtein.so"

I certainly miss something, hope somebody will help me, thanks by advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/70ffb6bf-283d-48ca-a644-5bae378dcfea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to