原说明文档路径
1.django-admin-tools安装(windows系统)pip install django-admin-tools 2.添加django.core.context_processors.request 到TEMPLATE_CONTEXT_PROCESSORS 或者TEMPLATES 中,取决于django版本,而django1.8以上版本已经集成为django.template.context_processors.request 3.添加admin_tools.template_loaders.Loader 到 TEMPLATE_LOADERS 或者 TEMPLATES ,依然取决于django版本,django1.8以上默认不显示loader配置,需要自行手动添加,admin_tools.template_loaders.Loader需要配置在所有loader之前,而添加了loader配置,也需要把默认使用的loader添加进去,样例为:
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], 'loaders': [ 'admin_tools.template_loaders.Loader', 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ], }, }, ]4.django1.8以上版本需要删除TEMPLATES下的'APP_DIRS': True
INSTALLED_APPS = ( 'admin_tools', 'admin_tools.theming', 'admin_tools.menu', 'admin_tools.dashboard', 'django.contrib.auth', 'django.contrib.sites', 'django.contrib.admin' # ...other installed applications... )5.添加路径 urls.py:
urlpatterns = patterns('', url(r'^admin_tools/', include('admin_tools.urls')), #...other url patterns... )6.运行:
python manage.py migrate python manage.py collectstatic7.确认django.contrib.staticfiles.finders.AppDirectoriesFinder 在STATICFILES_FINDERS中,样例:
# 这个是默认设置,Django 默认会在 STATICFILES_DIRS中的文件夹 和 各app下的static文件夹中找文件 # 注意有先后顺序,找到了就不再继续找了 STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder" )8.运行项目后台效果即可改变
