contrib.staticfiles和Django管理媒体 [英] contrib.staticfiles and Django admin media
问题描述
我刚刚从1.2切换到主干(在撰写本文时为r15175)来玩contrib.staticfiles
,现在使用本地devserver时,我所有的管理媒体都返回404.静态媒体(由新的contrib应用程序管理)所有的工作都按预期进行,但是我希望能够将admin与开发服务器一起使用,以便在开发代码更改时不必重新启动本地apache实例.
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.
这是已知的行为吗?我尚未在IRC中得到回应.
Is this known behaviour? I haven't gotten a response in IRC.
似乎与以下内容有关:管理媒体消失了在开发模式下运行django trunk时,但似乎没有实际答案.
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.
推荐答案
I was having the same problem, finally noticed this line in the docs for ADMIN_MEDIA_PREFIX
:
要与静态文件集成,此名称应与STATIC_URL相同,后跟"admin/".
For integration with staticfiles, this should be the same as STATIC_URL followed by 'admin/'.
这样做对我来说是固定的.
Doing that fixed it for me.
编辑2012-03-12 :请注意,自Django 1.4起,ADMIN_MEDIA_PREFIX
已被
Edit 2012-03-12: Note that as of Django 1.4, ADMIN_MEDIA_PREFIX
has been deprecated.
这篇关于contrib.staticfiles和Django管理媒体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!