contrib.staticfiles and Django admin media

假装没事ソ 提交于 2020-01-01 08:54:08

问题


I just switched from 1.2 to trunk (r15175 at this writing) to play with contrib.staticfiles, and now when using the local devserver all my admin media returns a 404. The static media (as managed by the new contrib app) all work as expected, but I'd like to be able to use the admin with the dev server so that I don't have to restart a local apache instance when dev code changes.

Is this known behaviour? I haven't gotten a response in IRC.

edit: Seems related to: Admin media disappear while running django trunk in development mode, but there didn't seem to be an actual answer there.


回答1:


I was having the same problem, finally noticed this line in the docs for ADMIN_MEDIA_PREFIX:

For integration with staticfiles, this should be the same as STATIC_URL followed by 'admin/'.

Doing that fixed it for me.

Edit 2012-03-12: Note that as of Django 1.4, ADMIN_MEDIA_PREFIX has been deprecated.




回答2:


Are you developing on Windows?

If so (or even if not) have a look at the Django bug Cannot load admin interface static files when doing tutorial. Could be the cause of your problems.



来源:https://stackoverflow.com/questions/4694449/contrib-staticfiles-and-django-admin-media

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!