简体   繁体   English

django管理员django.contrib.staticfiles

[英]django admin django.contrib.staticfiles

I'm following the tutorial contained here: 我正在关注此处包含的教程:

http://www.djangobook.com/en/2.0/chapter06.html 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 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? 我注意到当我从INSTALLED_APPS取消注释django.contrib.staticfiles时,它看起来像链接一样不错,尽管本教程中未提及...有人可以向我解释此行为吗?

Thank you for your help! 谢谢您的帮助!

The Django Book is a little out of date (although an update is in the works I believe): Django Book有点过时了 (尽管我相信正在更新中):

This book was originally published by Apress in 2009, and covered Django 1.0. 这本书最初由Apress于2009年出版,涵盖了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 我们正在努力更新这本书,使其涵盖Django 1.4、1.5及更高版本

Static files are all the CSS/JS & images that your site (and the django admin) uses. 静态文件是您的网站(和django管理员)使用的所有CSS / JS和图像。 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 . 这是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. 网站通常需要提供其他文件,例如图像,JavaScript或CSS。 In Django, we refer to these files as “static files”. 在Django中,我们将这些文件称为“静态文件”。 Django provides django.contrib.staticfiles to help you manage them. Django提供了django.contrib.static文件来帮助您管理它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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