Using Recoll

Recoll: https://www.recoll.org/

I would like to use Recoll to index my Django website.
Indexing pdf, html, … files is not a problem and using the python interface from inside Django is not a problem.
But I would like to index Django objects which are stored in the database and only in it. So, following the Recoll documentation I must write a python script which should not be a problem. But, this script is launched by /usr/bin/recollindex : actually, irecollindex triggers my script but, as I must do something like:

from MyApp.models import *

it cannot find MyApp.

I do not know any way to do this: /usr/bin/recollindex cannot -as far as I know- find Django applications. Does anybody did something like this ?
Thanks !
Thierry

If you’re needing to write a script that relies upon the Django environment (specifically the ORM in this case), then you should probably write it as a custom management command. (It’s not the only way to do it, but it’s the easiest in my opinion.)

But, there’s nothing saying that you must use the ORM for this. (I don’t know Recoll, so I don’t know if there’s any benefit to using the ORM for this purpose.) You could access the database tables directly if that’s easier.

Someone replied to your post.

[KenWhitesell] KenWhitesell <Django Forum

February 4

If you’re needing to write a script that relies upon the Django
environment (specifically the ORM in this case), then you should
probably write it as a custom management command <https://
How to create custom django-admin commands | Django documentation | Django
django.core.management>. (It’s not the only way to do it, but it’s the
easiest in my opinion.)

But, there’s nothing saying that you must use the ORM for this. (I don’t
know Recoll, so I don’t know if there’s any benefit to using the ORM for
this purpose.) You could access the database tables directly if that’s
easier.

You are true, accessing the db directly is easy.
Thanks !

(Attachment tdumont50.vcf is missing)