Pinax源代码分析5 - about
这个app比较简单,就是将一些url映射到几个html模板。
url
(r'^about/', include('about.urls')),
urlpatterns = patterns('',
url(r'^$', direct_to_template, {"template": "about/about.html"}, name="about"),
url(r'^terms/$', direct_to_template, {"template": "about/terms.html"}, name="terms"),
url(r'^privacy/$', direct_to_template, {"template": "about/privacy.html"}, name="privacy"),
url(r'^dmca/$', direct_to_template, {"template": "about/dmca.html"}, name="dmca"),
url(r'^what_next/$', direct_to_template, {"template": "about/what_next.html"}, name="what_next"),
)
来源
site_base.html 包含如下一段:
{% block footer %}
<div class="legal">
{% trans "© 2008 <your company here>" %}
- <a href="{% url about %}">{% trans "About" %}</a>
- <a href="{% url terms %}">{% trans "Terms of Service" %}</a>
- <a href="{% url privacy %}">{% trans "Privacy Policy" %}</a>
- <a href="{% url dmca %}">{% trans "DMCA Notice" %}</a>
- Version: {% svn_app_version %}
- Django: {% svn_app_version "django" %}
</div>
{% endblock %}
在注册完成之后,会被导向what_next。
模板
what_next.html 存储在项目目录下的apps/about/ 子目录下,其它几个模板都存储在 lib 下 pinax 子目录下,都是简单的html页面。