简体   繁体   中英

django admin django.contrib.staticfiles

I'm following the tutorial contained here:

http://www.djangobook.com/en/2.0/chapter06.html

They say that the admin site should look like this:

http://www.djangobook.com/en/2.0/_images/admin_index.png

When I start the admin site, though, it looks really simplistic, just plain text and links:

Django administration

Welcome, admin. Change password / Log out
Site administration

Auth
Groups  Add Change
Users   Add Change
Recent Actions

My Actions

None available

I noticed that it looks all nice like the link when I uncomment django.contrib.staticfiles from the INSTALLED_APPS, although that wasn't mentioned in the tutorial...can someone please explain this behavior to me?

Thank you for your help!

The Django Book is a little out of date (although an update is in the works I believe):

This book was originally published by Apress in 2009, and covered Django 1.0. Since then, it's languished. We're working on getting the book updated to cover Django 1.4, 1.5, and beyond

Static files are all the CSS/JS & images that your site (and the django admin) uses. They need to be collected and placed somewhere that your server (or development server) can serve them. This is the job of django.contib.staticfiles .

You can read more about this in the 'Managing Static Files' documentation

Websites generally need to serve additional files such as images, JavaScript, or CSS. In Django, we refer to these files as “static files”. Django provides django.contrib.staticfiles to help you manage them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM