After adding django-cacheops user registration broke on in application. Attempting to disable all cacheops on models related to auth and rest_framework but issue still persisted.
I am not really sure how the two packages interop yet, just getting started with cacheops, so any tips for debugging would be helpful.
Exception
ERROR Register User Failed
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1823, in get_prep_value
return int(value)
ValueError: invalid literal for int() with base 10: ''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/code/users/serializers.py", line 246, in save
adapter.save_user(request, user, self)
File "/usr/local/lib/python3.8/site-packages/allauth/account/adapter.py", line 243, in save_user
user.save()
File "/code/users/models.py", line 144, in save
return super().save(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 67, in save
super().save(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 739, in save
self.save_base(using=using, force_insert=force_insert,
File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 787, in save_base
post_save.send(
File "/usr/local/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 180, in send
return [
File "/usr/local/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/usr/local/lib/python3.8/site-packages/funcy/decorators.py", line 45, in wrapper
return deco(call, *dargs, **dkwargs)
File "/usr/local/lib/python3.8/site-packages/cacheops/invalidation.py", line 21, in skip_on_no_invalidation
return call()
File "/usr/local/lib/python3.8/site-packages/funcy/decorators.py", line 66, in __call__
return self._func(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/site-packages/cacheops/query.py", line 447, in _post_save
invalidate_obj(instance, using=using)
File "/usr/local/lib/python3.8/site-packages/funcy/decorators.py", line 45, in wrapper
return deco(call, *dargs, **dkwargs)
File "/usr/local/lib/python3.8/site-packages/cacheops/invalidation.py", line 21, in skip_on_no_invalidation
return call()
File "/usr/local/lib/python3.8/site-packages/funcy/decorators.py", line 66, in __call__
return self._func(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/site-packages/cacheops/invalidation.py", line 45, in invalidate_obj
invalidate_dict(model, get_obj_dict(model, obj), using=using)
File "/usr/local/lib/python3.8/site-packages/funcy/decorators.py", line 45, in wrapper
return deco(call, *dargs, **dkwargs)
File "/usr/local/lib/python3.8/site-packages/funcy/flow.py", line 224, in post_processing
return func(call())
File "/usr/local/lib/python3.8/site-packages/cacheops/invalidation.py", line 117, in get_obj_dict
yield field.attname, field.get_prep_value(value)
File "/usr/local/lib/python3.8/site-packages/django/db/models/fields/related.py", line 977, in get_prep_value
return self.target_field.get_prep_value(value)
File "/usr/local/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1825, in get_prep_value
raise e.__class__(
ValueError: Field 'id' expected a number but got ''.
ERROR Internal Server Error: /api/v1/dj-rest-auth/registration/
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 581, in get_or_create
return self.get(**kwargs), False
File "/usr/local/lib/python3.8/site-packages/cacheops/query.py", line 353, in get
return qs._no_monkey.get(qs, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get
raise self.model.DoesNotExist(
rest_framework.authtoken.models.Token.DoesNotExist: Token matching query does not exist.
CACHEOPS = {
# Disable Op for User/Auth
'auth.*': None,
'rest_framework.authtoken.models.token': None,
# Default all model ops caching to 1 minute
'*.*': {'timeout': 60},
}
After adding django-cacheops user registration broke on in application. Attempting to disable all cacheops on models related to auth and rest_framework but issue still persisted.
I am not really sure how the two packages interop yet, just getting started with cacheops, so any tips for debugging would be helpful.
Exception
Pipfile
Settings