我一直在寻找使用django-pagination,并在安装 django=pagination 后将所有更改应用于 settings.py 但是当我运行我的服务器并访问页面时,分页肯定已经到达,但它破坏了 css 和js 元素。因此,该页面没有任何设计。我真的无法理解发生了什么。继承人的输出python manage.py runserver
:
[29/Jun/2013 10:26:53] "GET / HTTP/1.1" 200 11594
[29/Jun/2013 10:26:53] "GET /style/bootstrap.min.css HTTP/1.1" 404 3213
[29/Jun/2013 10:26:53] "GET /style/style.css HTTP/1.1" 404 3189
[29/Jun/2013 10:26:53] "GET /style/tabs.css HTTP/1.1" 404 3186
[29/Jun/2013 10:26:53] "GET /images/logo.png HTTP/1.1" 404 3189
[29/Jun/2013 10:26:53] "GET /js/jq.js HTTP/1.1" 404 3168
[29/Jun/2013 10:26:53] "GET /images/green_btn_main.png HTTP/1.1" 404 3219
[29/Jun/2013 10:26:53] "GET /js/jquery.js HTTP/1.1" 404 3180
[29/Jun/2013 10:26:53] "GET /js/bootstrap-tooltip.js HTTP/1.1" 404 3213
[29/Jun/2013 10:26:53] "GET /js/bootstrap-popover.js HTTP/1.1" 404 3213
[29/Jun/2013 10:26:53] "GET /js/bootstrap-tab.js HTTP/1.1" 404 3201
[29/Jun/2013 10:26:53] "GET /images/green_btn-2.png HTTP/1.1" 404 3210
[29/Jun/2013 10:26:53] "GET /images/logo.png HTTP/1.1" 404 3189
[29/Jun/2013 10:26:53] "GET /js/jquery.js HTTP/1.1" 404 3180
[29/Jun/2013 10:26:53] "GET /images/green_btn-2.png HTTP/1.1" 404 3210
[29/Jun/2013 10:26:53] "GET /images/green_btn_main.png HTTP/1.1" 404 3219
[29/Jun/2013 10:26:53] "GET /js/bootstrap-tooltip.js HTTP/1.1" 404 3213
[29/Jun/2013 10:26:53] "GET /js/bootstrap-popover.js HTTP/1.1" 404 3213
[29/Jun/2013 10:26:53] "GET /js/bootstrap-tab.js HTTP/1.1" 404 3201
git diff
继承人的部分settings.py
被修改:
@@ -95,6 +95,8 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
+ 'pagination.middleware.PaginationMiddleware',
+
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
@@ -127,6 +129,7 @@ INSTALLED_APPS = (
'rest_framework',
'south',
'ui',
+ 'pagination',
)
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+ 'django.contrib.auth.context_processors.auth',
+ 'django.core.context_processors.debug',
+ 'django.core.context_processors.i18n',
+ 'django.core.context_processors.media',
+ 'django.core.context_processors.request',
+)
是的,在django-pagination
文档中据说使用django.core.context_processors.auth
而不是django.contrib.auth.context_processors.auth
但是当我遇到错误时我使用了前者,该错误在这里得到了正确回答。它是关于上的Django 1.4
。是的,我在上1.4
有人请帮帮我。所有的 UI 设计都消失了,只有文字。
更新:我做了一个git stash
撤消我的更改,并且所有元素都加载得很好。它必须是settings.py
文件中的行之一。有人能分辨出是哪一个吗?