Django 的管理页面缺少典型的格式/样式,我设置错了吗? [英] Django's admin pages are missing their typical formatting/style, have I set it up wrong?

查看:10
本文介绍了Django 的管理页面缺少典型的格式/样式,我设置错了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于让我的 django 安装工作了,但是我注意到管理页面的典型外观和感觉缺失了,就好像没有应用于页面结构的样式一样.我是否有某种设置问题或路径问题导致无法找到样式表?它们存储在哪里?我的页面看起来像是 1994 年的.

I finally got my django install working, however I'm noticing that the typical look and feel of the admin pages are missing, and it's as if there are no styles applied to the structure of the pages. Do I have some kind of setup issue or pathing issue that's preventing the style sheets from being found? Where are they stored? My pages look like they are from 1994.

推荐答案

听起来您的管理媒体服务不正确.在您的 settings.py 中,有一个名为 ADMIN_MEDIA_PREFIX 的变量,它指定 Django 应该在其中查找它们的 URL.实际的媒体文件位于[Python 站点包的路径]/django/contrib/admin/media"中.使用 manage.py runserver 时,文件会自动"提供.但是,在使用 Apache/nginx/etc 时,您有责任确保您的服务器在该 URL 上提供文件(使用重写规则、符号链接等).更多信息可以在这里找到.

Sounds like your admin media isn't being served correctly. In your settings.py, there's a variable called ADMIN_MEDIA_PREFIX, which specifies the URL where Django should look for them. The actual media files are in "[path to your Python site-packages]/django/contrib/admin/media". When using manage.py runserver, the files are served "automagically". However, when using Apache/nginx/etc it's your responsibility to make sure that your server makes the files available at that URL (using rewrite rules, symlinks, etc). More info can be found here.

这篇关于Django 的管理页面缺少典型的格式/样式,我设置错了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆