contrib.staticfiles 和 Django 管理媒体
我刚刚从 1.2 切换到 trunk(在撰写本文时为 r15175)来使用 contrib.staticfiles
,现在当使用本地开发服务器时,我的所有管理媒体都会返回 404。静态媒体(由新的 contrib 应用程序)都按预期工作,但我希望能够将管理员与开发服务器一起使用,这样当开发代码更改时我就不必重新启动本地 apache 实例。
这是已知的行为吗?我还没有在 IRC 中得到回复。
编辑:似乎与以下内容相关: 管理媒体在运行 django 时消失trunk处于开发模式,但那里似乎没有实际答案。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的问题,终于注意到 docs 中的这一行 对于
ADMIN_MEDIA_PREFIX
:这样做为我解决了这个问题。
编辑 2012 年 3 月 12 日:请注意,从 Django 1.4 开始,
ADMIN_MEDIA_PREFIX
已 已弃用。I was having the same problem, finally noticed this line in the docs for
ADMIN_MEDIA_PREFIX
:Doing that fixed it for me.
Edit 2012-03-12: Note that as of Django 1.4,
ADMIN_MEDIA_PREFIX
has been deprecated.您在 Windows 上进行开发吗?
如果是这样(或者即使不是),请查看 Django bug 在执行教程时无法加载管理界面静态文件< /a>.可能是您出现问题的原因。
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.