Question

I was looking to use django-pagination, and I applied all the changes to settings.py after installing django=pagination but when I ran my server and accesssed the page, pagination has arrived for sure, but it broke all the paths to css and js elements. Thus the page is void of any design. I really cant understand what happened. Heres the output at 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

And heres the part of git diff of the settings.py which was modified:

@@ -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',
+)

Yes in the django-pagination docs it is said to use django.core.context_processors.auth and not django.contrib.auth.context_processors.auth But I used the former when I hit an error which was correctly answered here. Its about being on Django 1.4. yes I am on 1.4 Someone please help me. All the UI design has vanished with only the texts.

Update: I did a git stash to undo my changes and all the elements load up fine. It must be one of the lines in the settings.py file. Can someone pint out which one?

Était-ce utile?

La solution

You lost "django.core.context_processors.static", so you got a lot of 404.

Default TEMPLATE_CONTEXT_PROCESSORS is:

("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.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages")

The solution of this link may be a better practice.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top