.. _templates: ================== 主题开发的其他说明 ================== 在html中应使用软连接 ===================== 如果你需要在html中引入本地静态文件,你应该这样做:: {% load static %} 如果你需要使用文章url或者其他url,你应该这样做::
如何在html中读取新建的配置? ============================== 在admin中新建的配置默认在html代码中是无法获取,你需要修改两个地方 1. 新建 ``custom_theme/consts.py`` 文件,并添加 ``custom_theme_config_context`` :: custom_theme_config_context = { 'my_config' : '我的自定义配置' } 2. 在 ``custom_theme/app.py`` 中添加 ``deeru_config_context`` :: class CustomThemeConfig(AppConfig): ... deeru_config_context = 'custom_theme.consts.custom_theme_config_context' 关于评论的form ==================== 文章详情页面传了一个 CommentForm ,但并不建议直接用它来生成form。另外,该form评论中content生成的 ``