我认为在这种情况下使用上下文处理器实在是太过分了。你可以轻松地做到这一点:
#base.html<html> <head> <title>{% block title %}My Cool Website{% endblock %}</title> </head> <body> {% block content %}{% endblock %} </body></html>接着:
# blog.html{% extends 'base.html' %}{% block content %} <h1>{% block title %}My Blog{% endblock %}</h1> Lorem ipsum here...{% endblock %}依此类推…看起来与DRY兼容。



