django-admin-interface: Logo & Favicon not rendering

I’ve configured everything as it should be but Django cannot find the favicon or logo. What am I missing?

# settings.py
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = "/media/"
# urls.py
from django.contrib import admin
from django.urls import path
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path("", admin.site.urls),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

I can see that the files are correctly being stored as expected: app\media\admin-interface\favicon\favicon.ico

Python version 3.10.12

Django version 4.2.4

Package version 0.26.0

Current behavior (bug description)

[DJANGO] WARNING 2023-08-13 12:52:56,660 log django.request.log_response:241: Not Found: /media/admin-interface/favicon/favicon.ico
[DJANGO] WARNING 2023-08-13 12:53:26,440 log django.request.log_response:241: Not Found: /media/admin-interface/logo/Logo_kyvHNK9.png

Expected behavior I’m expecting the favicon and logo to render in the admin GUI.

Upvote & Fund

  • We’re using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
<picture> <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/fabiocaccamo/django-admin-interface/issues/310/pledge.svg?darkmode=1"> Fund with Polar </picture>

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@CharlesFr During production enviroment system you should create (if your system is inside a docker container) a named volume with entire folder upload media for logo and favicon with created by admin_interface application

like this

version: '3.9'
volumes:
    pgdata:
    media:


services:
    django:
        build: .
        ports:
            - 8000:8000
        volumes:
            - ./:/app/
            - media:/media/
            - ./<app_label_project>/admin-interface:/media/admin-interface
        env_file:
            - ./.env_dev
        entrypoint: python <app_label_project>/manage.py runserver 0.0.0.0:8000
        depends_on:
            - postgres
        
# other services

and is base settings of project:

STATIC_URL = "/static/"

STATIC_ROOT = "/static/"

MEDIA_URL = "/media/"

MEDIA_ROOT = "/media/"`

othwrwhise in urls.py of the projects (not in app):

from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
# your urls
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

They are not mentioned because are standard django settings that must always be configured correctly to use media and static files.