Best practice to select staticfiles to avoid Django's "Found another file with the destination path" during collectstatic?

Hello!

So I’m using Django 4.2, with Django-JET admin package via Django-jet-reboot fork; it enhances Admin with nice functionality and UX.

Each time I deploy my app on production, it feels its taking much longer when it reach collectstatic command cause it throws Found another file with the destination path warnings.

Now it seems it’s related to Django-Jet’s css & js files that needs to override django.contrib.admin ones, so my two questions are:

  • Is this harmless and working as designed for my use-case? or there is a better practice to handle this?

    • (like specifically configuring not looking for those django files? or add them to local static folder?)
  • Will adding additional UI-changing package(s) be ok with this?

    • For example I’m looking at creative tims’ Black Dashboard Django - So I just manage it’s priority in INSTALLED_APPS and let it be? = By putting it after jet so it doesn’t override that package assets (want jet admin assets for /admin + Black DB for other template pages elsewhere).

Issue Details

Found another file with the destination path 'admin/css/base.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/css/changelists.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/css/dashboard.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/css/forms.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/css/login.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/css/rtl.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/css/widgets.css'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/js/SelectFilter2.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/js/admin/DateTimeShortcuts.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.
Found another file with the destination path 'admin/js/admin/RelatedObjectLookups.js'. It will be ignored since only the first encountered file is collected. If this is not what you want, make sure every static file has a unique path.

And doing the python manage.py findstatic Command on them, gives:

Found 'admin/css/base.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/base.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/base.css
Found 'admin/css/changelists.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/changelists.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/changelists.css
Found 'admin/css/dashboard.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/dashboard.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/dashboard.css
Found 'admin/css/forms.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/forms.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/forms.css
Found 'admin/css/login.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/login.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/login.css
Found 'admin/css/rtl.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/rtl.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/rtl.css
Found 'admin/css/widgets.css' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/css/widgets.css
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/css/widgets.css
Found 'admin/js/SelectFilter2.js' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/js/SelectFilter2.js
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/js/SelectFilter2.js
Found 'admin/js/admin/DateTimeShortcuts.js' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/js/admin/DateTimeShortcuts.js
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
Found 'admin/js/admin/RelatedObjectLookups.js' here:
  /usr/local/lib/python3.10/site-packages/jet/static/admin/js/admin/RelatedObjectLookups.js
  /usr/local/lib/python3.10/site-packages/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js

My Settings

INSTALLED APPS

DJANGO_APPS = [
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.sites",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "jet",
    "django.contrib.admin",
    "django.forms",
]

THIRD_PARTY_APPS = [
    "django_filters",
    "crispy_forms",
    "crispy_bootstrap5",
    "allauth",
    "allauth.account",
    "allauth.socialaccount",
    "rest_framework",
    # 'rest_framework_json_api',
    "django_extensions",
    "rest_framework.authtoken",
    "corsheaders",
    "drf_spectacular",
]

Static files Configs

# STATIC
# ------------------------------------------------------------------------------
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
APPS_DIR = ROOT_DIR / "backend" #Main Django App Folder Name

STATIC_ROOT = str(ROOT_DIR / "staticfiles")

STATIC_URL = "/static/"

STATICFILES_DIRS = [
    str(APPS_DIR / "static"),
]

STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
]

This is working exactly as designed. This is precisely how you replace system-supplied static files with customized versions. It’s the same concept as overriding templates.

Got it! Thanks alot @KenWhitesell.