django - contrib.staticfiles和Django管理媒体

标签 django django-contrib

我刚刚从1.2切换到主干(在撰写本文时为r15175)来使用contrib.staticfiles,现在使用本地devserver时,我所有的管理媒体都返回404。静态媒体(由新的contrib应用程序管理)都按预期工作,但我希望能够将admin与开发服务器一起使用,以便在开发代码更改时不必重新启动本地apache实例。

这是已知的行为吗?我尚未在IRC中得到回应。

编辑:似乎与:Admin media disappear while running django trunk in development mode有关,但似乎没有实际答案。

最佳答案

我遇到了同样的问题,最后在docs中注意到了ADMIN_MEDIA_PREFIX的这一行:

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



这样做对我来说很固定。

编辑2012-03-12 :请注意,自Django 1.4起,ADMIN_MEDIA_PREFIXdeprecated

关于django - contrib.staticfiles和Django管理媒体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4694449/

相关文章:

Django order_by,多个字段和优先级

django - Django包的间歇性ImportError

python - 将多个 .CSV 文件发送到 .ZIP 而无需在 Python 中存储到磁盘

python - 如何在python中生成文件而不将其保存到磁盘?

django - 在 urls.py 中使 slugs 正常工作时遇到问题

django - 使用 Django 缓存中间件导致 contrib.auth 单元测试失败

python - django 评论 : how to prevent form errors from redirecting the user to the preview page?

Django:为什么要创建一个OneToOne到UserProfile而不是将auth.User子类化?

python - 在 django 查询集中排列键顺序