AttributeError:'Settings'对象没有属性'ADMIN_MEDIA_PREFIX'

时间:2013-05-08 17:20:55

标签: django import django-admin key chained

我正在尝试使用ChainedForeignKey创建一个智能菜单,但到目前为止,我仍然坚持导入ChainedForeignKey

from smart_selects.db_fields import ChainedForeignKey 

我在Eclipse上使用pydev。 我在这里下载了智能选择包:http://pydoc.net/Python/django-smart-selects/1.0.2/ 并将其添加到我的PYTHONPATH

当我调试时我得到:

Traceback (most recent call last):
  File "C:\Users\Mr.Machine\Desktop\eclipse\plugins\org.python.pydev_2.7.0.2013032300\pysrc\pydevd.py", line 1397, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\Users\Mr.Machine\Desktop\eclipse\plugins\org.python.pydev_2.7.0.2013032300\pysrc\pydevd.py", line 1090, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "C:\Users\Mr.Machine\Desktop\Workspace\Medbook\testApp\forms.py", line 4, in <module>
    from smart_selects.db_fields import ChainedForeignKey 
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\db_fields.py", line 2, in <module>
    import form_fields
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\form_fields.py", line 1, in <module>
    from smart_selects.widgets import ChainedSelect
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\widgets.py", line 20, in <module>
    class ChainedSelect(Select):
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\widgets.py", line 30, in ChainedSelect
    class Media:
  File "C:\Users\Mr.Machine\Desktop\django-smart-selects-1.0.2\smart_selects\widgets.py", line 33, in Media
    ('js/jquery.min.js', 'js/jquery.init.js')]
  File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 54, in __getattr__
    return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'ADMIN_MEDIA_PREFIX'

任何帮助表示赞赏

1 个答案:

答案 0 :(得分:1)

将评论标记为答案以供将来参考:

看起来没有设置ADMIN_MEDIA_PREFIX

为ADMIN介质设置ADMIN_MEDIA_PREFIX='/static/'或任何其他适当的值将解决问题