问题
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:
- https://docs.djangoproject.com/en/3.1/releases/3.1/#django-contrib-admin
- 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.
Your browser is caching the CSS / JS from the old version, in which case clear your cache and reload.
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