Django 3.1 | Admin page appearance issue

♀尐吖头ヾ 提交于 2021-02-15 11:23:18

问题


Today I have updated Django to latest version 3.1.

But for some reason when the logged in to admin page, all I cans see is a weird looking admin page.

admin.py

Can someone help me what went wrong or what are things I need to modify to get back to original admin page.

Thanks in advance


回答1:


In your projects' root urls.py file, simply add the below code to disable the new sidebar feature.

from django.contrib import admin

admin.autodiscover()
admin.site.enable_nav_sidebar = False

Reference:

  1. https://docs.djangoproject.com/en/3.1/releases/3.1/#django-contrib-admin
  2. https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.AdminSite.enable_nav_sidebar



回答2:


It looks like one of two problems.

  1. Your browser is caching the CSS / JS from the old version, in which case clear your cache and reload.

  2. You didn't run ./manage.py collecstatic after updgrading.

Judging from your comment, it's probably the former.




回答3:


Your browser is caching the CSS / JS from the old version, in which case clear your cache and for that, you need to do Force Reload.

@Tom Carrick, you are right btw.

and to Force Reload in Chrome use Hold the Ctrl key and press the R.

and for Mozill Firefox Ctrl + Shift + R



来源:https://stackoverflow.com/questions/63286591/django-3-1-admin-page-appearance-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!