Replies: 1 comment 2 replies
-
Did you check if your cache is working? You can do that from the shell, just import cache and do a simple set get. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm running into an issue with my Django 3.2 + gunicorn setup where django-select2 items through a
ModelSelect2Widget
aren't available at all times.When e.g. "apple" is provided as input, most of the times I get
The results could not be loaded
while typing.The issue does not occur on my development install.
With a normal
Select2Widget
, the issue doesn't occur either.When trying to debug, I see https://mysite/select2/fields/auto.json?term=appl&field_id=somefieldid is reached. This URL shows proper output (
{"results": [{"text": "Apple test", "id": 4}, {"text": "Apple test2", "id": 5}, <...>
in about 1 out of 10 tries. In about 9/10 cases I get a 404.When looking at the installation documentation, I see a persistent cache backend is a requirement for django-select2. Since I'm using multiple workers on my gunicorn config, I'm assuming the above problem is the exact reason for this requirement. Could this be confirmed? As I'm not familiar with Redis and/or do not have a caching need so far.
If so: Django 4.0 now comes with native support of the Redis backend through
django.core.cache.backends.redis.RedisCache
.Is the recommendation to use the native django support or to use
django_redis
'?If native, is the below the
BACKEND
the only change that is required?Beta Was this translation helpful? Give feedback.
All reactions