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

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

问题描述

我终于得到了我的django安装工作,但是我注意到管理页面的典型外观缺少,就好像没有样式应用于页面的结构。我有某种安装问题或路径问题阻止了样式表的发现?他们在哪里存放?我的网页看起来像是1994年。

解决方案

听起来像您的管理媒体没有正确投放。在 settings.py 中,有一个名为 ADMIN_MEDIA_PREFIX 的变量,它指定Django应该查找的URL。实际的媒体文件位于[Python site-packages] / django / contrib / admin / media的路径中。当使用 manage.py runserver 时,文件将以自动方式投放。但是,当使用Apache / nginx / etc时,您有责任确保您的服务器使该URL上的文件可用(使用重写规则,符号链接等)。更多信息可以在这里找到。


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.

解决方案

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天全站免登陆