Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import to django_redis.cache fails #638

Closed
iurisilvio opened this issue Jan 6, 2023 · 2 comments
Closed

Import to django_redis.cache fails #638

iurisilvio opened this issue Jan 6, 2023 · 2 comments
Labels

Comments

@iurisilvio
Copy link
Contributor

Describe the bug
I can't import django_redis.cache.RedisCache to extend it, because the module access django.conf.settings on import time.

To Reproduce

$ python -c "import django_redis.cache"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./lib/python3.11/site-packages/django_redis/cache.py", line 12, in <module>
    DJANGO_REDIS_SCAN_ITERSIZE = getattr(settings, "DJANGO_REDIS_SCAN_ITERSIZE", 10)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./lib/python3.11/site-packages/django/conf/__init__.py", line 87, in __getattr__
    self._setup(name)
  File "./lib/python3.11/site-packages/django/conf/__init__.py", line 67, in _setup
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting DJANGO_REDIS_SCAN_ITERSIZE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
@iurisilvio iurisilvio added the bug label Jan 6, 2023
@iurisilvio
Copy link
Contributor Author

PR #639

@iurisilvio
Copy link
Contributor Author

It is ready to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant