File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 11import os
2+ import logging
3+ import time
4+
5+ # Set Django settings module before importing Django-related modules
26os .environ .setdefault ('DJANGO_SETTINGS_MODULE' , 'core.settings' )
37
8+ # Load environment variables
9+ from dotenv import load_dotenv
10+ # Load environment variables from .env.local
11+ load_dotenv (os .path .join (os .path .dirname (os .path .dirname (__file__ )), '.env.local' ))
12+
13+ # Django setup
414import django
515django .setup ()
616
17+ # Import Django and Redis modules after Django setup
718import redis
819from django .conf import settings
9- import time
10- import logging
11- from dotenv import load_dotenv
12-
13- # Load environment variables from .env.local
14- load_dotenv (os .path .join (os .path .dirname (os .path .dirname (__file__ )), '.env.local' ))
20+ from django .core .cache import cache
1521
1622logging .basicConfig (level = logging .INFO , format = '%(asctime)s - %(levelname)s - %(message)s' )
1723logger = logging .getLogger (__name__ )
@@ -143,7 +149,6 @@ def test_django_cache():
143149
144150 try :
145151 # Try to import the cache module
146- from django .core .cache import cache
147152 logger .info (f"Django cache backend: { cache .__class__ .__name__ } " )
148153
149154 logger .info ("Testing Django cache framework" )
You can’t perform that action at this time.
0 commit comments