0

I want to write django custom backend for search functionality of my site (using mysql match against query / fulltext search), so where should I write it? Should I write it in model of a new separate app. ? Or should I write it in some existing app. or should write it in some existing apps' model?

I am not much experienced in django and have never write any backend before. I know it can be done anyway, but I want to know what is recommended way.I assume it will be usable in other projects or apps also.

thanks

Hafiz
  • 4,187
  • 12
  • 58
  • 111

2 Answers2

1

Just put it in your app that requires your middleware. Or create a django app that holds all your middlewares.

ScotchAndSoda
  • 3,811
  • 4
  • 34
  • 38
  • any helpful link that I can follow? – Hafiz Aug 23 '12 at 08:22
  • Why do you want to write a custom middleware for text search? There are a lot of NoSql based technologies for that. – ScotchAndSoda Aug 24 '12 at 13:18
  • It is because I am using MySQL as my DB and in that I can use full text search not nosql based search, so is there any better way to do so? – Hafiz Aug 24 '12 at 20:12
  • I am basically doing it in mySQL for saving time other wise after once completing work after sometime I will convert few tables into noSQL based db. – Hafiz Aug 24 '12 at 20:27
  • check this similar question if you don't want to implement a real text search engine for the moment: http://stackoverflow.com/questions/2248743/django-mysql-full-text-search – ScotchAndSoda Aug 29 '12 at 13:19
  • Anyway, check for MongoDB, Solr, or Elasticsearch. I would prefere to spend two days with it and have a rapid search engine instead of relational DB search stuffs. I would suggest you using MongoDB and implement a reverse index. You can also program a cron job for preprogrammed updating of your indexes. Hope this could help. – ScotchAndSoda Aug 29 '12 at 13:25
0

Your backend is normal Python code, and just like other Python modules the files can live anywhere. As long as you are able to import it using the Python shell, django can use it.

In other words as long as it is in PYTHONPATH, then your applications can use it.

It does not need to be part of an app or a project.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
  • As stated in my question that I know that it can be done anyway but what is recommended way? Where normally these sort of backends live? – Hafiz Aug 20 '12 at 21:53