V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
woaicheny
V2EX  ›  Python

django 2.0 + xadmin 出现这个 ,求帮组

  •  
  •   woaicheny · 2018-02-12 22:21:25 +08:00 · 5135 次点击
    这是一个创建于 2256 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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
    2 条回复    2018-02-27 23:35:48 +08:00
    twor
        1
    twor  
       2018-02-12 23:14:24 +08:00
    我测试了一下,并没有出现错误,测试步骤

    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
    https://i.loli.net/2018/02/12/5a81aeacd47a2.png

    参考网页:
    https://github.com/sshwsfc/xadmin
    http://xadmin.readthedocs.io/en/docs-chinese/quickstart.html#id1

    我是新手,只能这样用笨办法帮你了 :)
    sdlearn
        2
    sdlearn  
       2018-02-27 23:35:48 +08:00
    9. ./manage.py createsuperuser
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3219 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 13:04 · PVG 21:04 · LAX 06:04 · JFK 09:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.