【问题标题】:django-postman extends a base.html that does not existdjango-postman 扩展了一个不存在的 base.html
【发布时间】:2012-10-11 05:38:08
【问题描述】:

我已经根据documentation安装并配置了django-postman

urls.py 我项目的根目录中:

(r'^messages/', include('postman.urls')),

在 settings.py 中:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'grappelli',
    'filebrowser',
    'django.contrib.admin',
    'south',
    'postman',
    'MeetingManagerHub',
    'PersonHub',
    'TaskManagerHub',
    'AgencyHub',
    'DrHub',
    'CompanyHub',
    'AdvHub',
    'CarHub',
    'django.contrib.comments',
    'easy_maps',
    'MagazineHub',
    'captcha',
    'pagination'
)

所以我输入地址:http://127.0.0.1:8081/messages/inbox/ 但是当我点击链接时,它们都不起作用!我只看到这个页面! 更新

我创建了一个包含以下内容的 man_base.html 文件:

<html>
<head>
<title>{% block title %}{% endblock %}</title>
{% block extrahead %}{% endblock %}
</head>
<body>
{% block postman_menu %}{% endblock %}
{% block content %}{% endblock %}
</body>
</html>

并将这一行添加到base.html 文件的开头:

{% extends "postman/main_base.html" %}

它成功了!

【问题讨论】:

  • 当页面加载并被点击时,您的 javascript 控制台中会显示哪些错误?
  • 每个链接的 URL 是什么?

标签: python django


【解决方案1】:

您是否将预期的base.html 添加到您的TEMPLATE_DIRS 根目录中?

postman/base.html 模板扩展了 base.html 站点模板,在 其中一些块是预期的:标题:在,在 至少对于整个标题字符串的一部分额外标题:在 , 放一些和元素内容:在 , 将页面内容 postman_menu: 放入, 放一个导航菜单

也不是same page上的媒体文件的咆哮

【讨论】:

  • base.html 扩展了另一个 django 找不到的 base.html,所以我从 base.html 中删除了行 {% extends "base.html" %} !!
  • 别那样做,用预期的元素创建一个 base.html!
猜你喜欢
  • 1970-01-01
  • 2012-09-27
  • 2021-02-05
  • 1970-01-01
  • 2020-11-15
  • 2018-06-06
  • 1970-01-01
  • 1970-01-01
  • 2021-03-23
相关资源
最近更新 更多