Django 3.1 | Admin page appearance issue

后端 未结 3 819
故里飘歌
故里飘歌 2020-12-30 03:01

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.

相关标签:
3条回答
  • 2020-12-30 03:45

    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
    0 讨论(0)
  • 2020-12-30 03:47

    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.

    0 讨论(0)
  • 2020-12-30 03:50

    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

    0 讨论(0)
提交回复
热议问题