Don't read from STATIC_ROOT directly
authorRadek Czajka <radekczajka@wolnelektury.pl>
Mon, 9 Nov 2026 23:17:40 +0000 (00:17 +0100)
committerRadek Czajka <radekczajka@wolnelektury.pl>
Mon, 9 Nov 2026 23:17:40 +0000 (00:17 +0100)
src/club/models.py
src/opds/views.py
src/reporting/views.py

index 8c6c8db..792d6c8 100644 (file)
@@ -515,7 +515,7 @@ class PayUOrder(payu_models.Order):
         temp = tempfile.NamedTemporaryFile(prefix='receipt-', suffix='.pdf', delete=False)
         temp.close()
         render_to_pdf(temp.name, 'club/receipt.texml', ctx, {
-            "wl.eps": os.path.join(settings.STATIC_ROOT, "img/wl.eps"),
+            "wl.eps": os.path.join(settings.PROJECT_DIR, "static/img/wl.eps"),
             })
 
         with open(temp.name, 'rb') as f:
index d2d7b6e..3862c5c 100644 (file)
@@ -77,15 +77,15 @@ class OPDSFeed(Atom1Feed):
     link_rel = "subsection"
     link_type = "application/atom+xml"
 
-    _book_parent_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book-parent.png")), str)()
+    _book_parent_img = lazy(lambda: full_url(os.path.join(settings.PROJECT_DIR, "static/img/book-parent.png")), str)()
     try:
-        _book_parent_img_size = str(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book-parent.png")))
+        _book_parent_img_size = str(os.path.getsize(os.path.join(settings.PROJECT_DIR, "static/img/book-parent.png")))
     except OSError:
         _book_parent_img_size = ''
 
-    _book_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book.png")), str)()
+    _book_img = lazy(lambda: full_url(os.path.join(settings.PROJECT_DIR, "static/img/book.png")), str)()
     try:
-        _book_img_size = str(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book.png")))
+        _book_img_size = str(os.path.getsize(os.path.join(settings.PROJECT_DIR, "static/img/book.png")))
     except OSError:
         _book_img_size = ''
 
index eb64746..22c0e52 100644 (file)
@@ -79,7 +79,7 @@ def catalogue_pdf(path):
         'orphans': orphans,
         'books_by_parent': books_by_parent,
     }, {
-        "wl-logo.png": os.path.join(settings.STATIC_ROOT, "img/logo-big.png"),
+        "wl-logo.png": os.path.join(settings.PROJECT_DIR, "static/img/logo-big.png"),
     })