我正在尝试安装djanjo-grappeli软件包。
我的设置:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
#'south',
'app_salon',
'app_agenda',
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.contrib.auth.context_processors.auth',
)
我的urls.py
urlpatterns = patterns('',
url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
url(r'^admin/', include(admin.site.urls)),
)
但它返回:
找不到页面(404) 请求方法:GET 请求网址:localhost:8000 / grappelli 使用salon.urls中定义的URLconf,Django按以下顺序尝试了这些URL模式: ^格拉佩利/ ^管理员/ 当前的网址grappelli与其中任何一个都不匹配。
答案 0 :(得分:2)
像这样更改INSTALLED_APPS
:
INSTALLED_APPS = (
'grappelli',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#'south',
'app_salon',
'app_agenda',
)
并确保您具有以下设置:
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
TEMPLATE_CONTEXT_PROCESSORS = (
...
"django.core.context_processors.request",
)
然后收集媒体文件:
$ python manage.py collectstatic
来源:https://django-grappelli.readthedocs.org/en/latest/quickstart.html