我正在尝试安装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
Django使用salon.urls中定义的URLconf,按以下顺序尝试了以下URL模式:
^ grappelli /
^ admin /
当前的网址grappelli与任何这些都不匹配。
最佳答案
像这样更改您的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
关于python - 找不到页面grappelli-django安装,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21437487/