SCGR commited on
Commit
c79c7ae
·
1 Parent(s): 278a64b

generate thumbnail for production

Browse files
py_backend/generate_production_thumbnails.py CHANGED
@@ -23,14 +23,25 @@ from app import storage
23
  from app.config import settings
24
 
25
  # Configure logging
26
- logging.basicConfig(
27
- level=logging.INFO,
28
- format='%(asctime)s - %(levelname)s - %(message)s',
29
- handlers=[
30
- logging.StreamHandler(sys.stdout),
31
- logging.FileHandler('thumbnail_conversion.log')
32
- ]
33
- )
 
 
 
 
 
 
 
 
 
 
 
34
  logger = logging.getLogger(__name__)
35
 
36
  class ThumbnailConverter:
 
23
  from app.config import settings
24
 
25
  # Configure logging
26
+ try:
27
+ # Try to write to /tmp which should be writable in Docker
28
+ logging.basicConfig(
29
+ level=logging.INFO,
30
+ format='%(asctime)s - %(levelname)s - %(message)s',
31
+ handlers=[
32
+ logging.StreamHandler(sys.stdout),
33
+ logging.FileHandler('/tmp/thumbnail_conversion.log')
34
+ ]
35
+ )
36
+ except PermissionError:
37
+ # Fallback to console-only logging if file writing fails
38
+ logging.basicConfig(
39
+ level=logging.INFO,
40
+ format='%(asctime)s - %(levelname)s - %(message)s',
41
+ handlers=[
42
+ logging.StreamHandler(sys.stdout)
43
+ ]
44
+ )
45
  logger = logging.getLogger(__name__)
46
 
47
  class ThumbnailConverter: