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.