liberation / django-elasticsearch

Simple wrapper around elasticsearch-py to index/search a django Model.
MIT License
211 stars 73 forks source link

Changing settings with django @override_settings decorator doesn't work #67

Open M1ha-Shvn opened 7 years ago

M1ha-Shvn commented 7 years ago

To be concrete, I've tried to change production database with test one in UnitTests by changing the value of ELASTICSEARCH_DEFAULT_INDEX variable. The problem is, that EsIndexable.Elasticsearch.index is substituted from settings only once on class creation, and any changes in django.settings doesn't affect it. The solution is writing dynamic property. I'm not sure, but this problem may also occure with other SETTING's variables.

lauxley commented 7 years ago

Hello, this is indeed a very valid problem, thank you for reporting it.