django 2.0 + xadmin 出現這個 ,求幫組

File "/Users/lichenji/Desktop/Dailyfresh/extra_apps/xadmin/util.py", line 94, in vendor
media.add_css({'screen': files})
AttributeError: 'Media' object has no attribute 'add_css'
[12/Feb/2018 22:10:56] "GET /xadmin/ HTTP/1.1" 500 134887
已邀請:

黑鍋txt

贊同來自:

我測試瞭一下,並沒有出現錯誤,測試步驟

1. 新建一個 python3.6 環境
2. source env/bin/activate
3. pip install django //安裝的是 Django-2.0.2
4. pip install git+git://github.com/sshwsfc/xadmin.git@django2 #看的 github 主頁上 2.0 需要這樣安裝
5. django-admin startproject testpro
6. 修改 testpro/settings.py ,添加三行
···
'xadmin',
'crispy_forms',
'reversion',
···
7. 修改 testpro/urls.py ,如下
···
from django.contrib import admin
from django.urls import path
import xadmin

xadmin.autodiscover()

from xadmin.plugins import xversion
xversion.register_models()

urlpatterns = [
path('xadmin/', xadmin.site.urls),
]
···
8. ./manage.py migrate
9. ./manage.py createsupersuer
10. ./manage.py runserver

運行 ok
/uploads/answer/2018/02/13/mzxbpqosikv124136.png

參考網頁:
https://github.com/sshwsfc/xadmin
http://xadmin.readthedocs.io/en/docs-chinese/quickstart.html#id1

我是新手,隻能這樣用笨辦法幫你瞭 :)

要回復問題請先登錄註冊