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.
所以我使用Django 4.2,通过Django-jet-reboot fork使用Django-JET admin包;它通过很好的功能和UX增强了Admin。
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:
现在它似乎与Django-Jet的css&js文件相关,这些文件需要覆盖django.contri.admin文件,所以我的两个问题是:
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?
添加额外的UI更改包(S)可以吗?
- For example I'm looking at creative tims' Black Dashboard Django - I just manage on it's priority in INSTALLED_APPS and let it be? = after
jet
so it doesn't override that package but takes the additional ones.
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:
并在它们上执行pythonManage.py findStatic命令,则会得到:
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",
]
更多回答
Got A response from Django Team:
"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."
得到了Django团队的回应:“这完全是按照设计来工作的。这正是你用定制版本替换系统提供的静态文件的方式。这与覆盖模板的概念相同。”
Incase someone thought the warnings means there's more to do (Sometimes it does; if you mistakenly duplicated finders on samefiles, so check findstatic first)
以防有人认为警告意味着还有更多的工作要做(有时的确如此;如果您错误地在相同的文件中复制了查找程序,请首先检查findStatic)
更多回答
我是一名优秀的程序员,十分优秀!