Django BootstrapAdmin + Setting.py Configuration tutorial

Time:2020-6-29

Compared with the native admin background of Django, bootstrap admin is fuller and more beautiful.
Comparison of the above figures.

original edition

Django BootstrapAdmin +   Setting.py   Configuration tutorial]

Bootstrap Admin

Django BootstrapAdmin +   Setting.py   Configuration tutorial

By contrast, is the background interface supported by bootstrap more attractive to customers.

install

pip install bootstrap_admin

After the installation is successful, it does not end. You need to setting.py In order to take effect.

INSTALLED_APPS = [
    'bootstrap_admin',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    ]

stay setting.py Found inINSTALLED_APPS, add in the first linebootstrap_admin

Be sure to place it in thedjango.contrib.adminabove.

At this point, if you open the background again, the bootstrap should take effect,

If you are a Windows user, the CSS effect of the page may be messy, indicating that the page file has not found the access address,

At this time, you also need tosetting.pyFound inTEMPLATESThis configuration item.
Put the

'DIRS': [os.path.join(BASE_DIR, 'templates'),]
Revised as
'DIRS': [os.path.join(BASE_DIR, 'templates').replace('\\', '/'),]

OK, bootstrap’s background is completed. If you need other Django courses or related questions, you can also pay attention to my official account.
Django BootstrapAdmin +   Setting.py   Configuration tutorial