Search code examples
djangodjango-rest-frameworkstaticdjango-admin

Django warnings (Make sure every static file has a unique path)


What is the reason for this warnings? I get them during docker-compose up command.

Found another file with the destination path 'admin/js/vendor/jquery/LICENSE.txt'. 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/img/LICENSE'. 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.

My INSTALLED_APPS in settings.py looks like:

INSTALLED_APPS = [
    "adminlte3",
    "adminlte3_theme",
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "rest_framework",
    "corsheaders",
    "django_extensions",
    "drf_standardized_errors",
    "user",
    "celery",
]

Statics:

PROJECT_ROOT = os.getcwd()

STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")

So, If I run python manage.py findstatic I find a lot of duble path files. For example,

C:\Users\irina\app-backend\django_env\Lib\site-packages\adminlte3_theme\static\admin\js\core.js
 C:\Users\irina\app-backend\django_env\Lib\site-packages\django\contrib\admin\static\admin\js\core.js

Solution

  • I solved the problem by adding

    python manage.py collectstatic --no-input --ignore admin
    

    to my docker/bash/entrypoin.sh

    I have no thougnts why

    python manage.py collectstatic --no-input --ignore \app_folder_name\static\admin
    

    didn't work.