且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Django开发服务器中提供静态文件

更新时间:2022-12-05 09:55:06

,您仍然需要将 STATIC_URL 传递到视图中的模板.最简单的方法是使用 RequestContext ,只要'TEMPLATE_CONTEXT_PROCESSORS'包含 static 条目即可.

you still need to pass STATIC_URL to the template in your view. The easiest way to do this is using RequestContext as long as the 'TEMPLATE_CONTEXT_PROCESSORS' include the static entry.