安装¶
安装 flatpages app,如下操作:
-
安装
sites framework
在setting.pyINSTALLED_APPS
添加'django.contrib.sites'
Also make sure you’ve correctly set
SITE_ID
to the ID of the site the settings file represents. This will usually be1
(i.e.SITE_ID =1
, but if you’re using the sites framework to manage multiple sites, it could be the ID of a different site. -
在setting.py
INSTALLED_APPS
添加'django.contrib.flatpages'
-
在URLconf添加一条:
urlpatterns = patterns('', (r'^pages/', include('django.contrib.flatpages.urls')), )
或者:
- setting.py
MIDDLEWARE_CLASSES 添加
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware'
- 执行命令
manage.py migrate
.