参考链接:https://docs.djangoproject.com/en/1.11/ref/contrib/flatpages/
知识点:
- 通过
django.site
数据库记录表,对应域名
和请求站点的关系;
SITE_ID 进行设置
- URLconf中进行通配设置,但须放置到配置最后面:
urlpatterns += [
url(r'(?P<url>.*/)$'), views, name="xxx"),
]
- URLconf中进行硬编码:
from django.contrib.flatpages import views
urlpatterns += [
url(r'^about-us/$', views.flatpage, {'url': '/about-us/'}, name='about'),
url(r'^license/$', views.flatpage, {'url': '/license/'}, name='license'),
]