没有风格/ CSS在Django管理 [英] No Style/css On Django Admin
问题描述
我是一个完整的新手到了Apache,因此整个部署过程一直在背后一痛,所以我承担。
I'm a complete newbie to apache, so the the whole deployment process has been a pain in the backside, so bear with me.
我使用的CSS格式有我的管理站点的问题,它只是即将到来的纯HTML。
I'm having the problem of my admin site using the css formatting, it's just coming up as plain html.
我知道有一些在这里和其他地方的回答这个问题,其他问题,但对我的生活我想不出得到它的工作。因此,如果任何人都可以发现什么,我搞乱了,我会感激不尽。
I know there are other questions that answer this issue here and elsewhere, but for the life of me I can't figure out to get it working. So if anyone can spot what I'm messing up I'd be eternally grateful.
在settings.py相关行是:
The relevant lines in settings.py are:
STATIC_ROOT = '/var/www/logparseradmin/logparser/static'
STATIC_URL = 'http://theyard/logparseradmin/static/'
ADMIN_MEDIA_PREFIX = '/var/www/Django-1.3.1/django/contrib/admin/media/'
和我有:
Alias /static/ /var/www/Django-1.3.1/django/contrib/admin/media/
在我的httpd.conf。
in my httpd.conf.
我已经尝试了一大堆关于这个变化,在互联网上的各种答案建议,但没有运气。
I've tried a whole bunch of variations on this, as the various answers on the Internet have suggested, but no luck.
非常感谢。
推荐答案
有至少三件事情错在这里。
There's at least three things wrong here.
首先,你STATIC_URL是不是可能是一个有效的URL - 的http:// theyard /
不是一个真正的域名,不会工作,除非你有本地DNS解析(其中,由于你的自我描述新手状态,似乎不太可能。)
Firstly, your STATIC_URL is not probably a valid URL - http://theyard/
is not a real domain name, and won't work unless you've got local DNS resolution (which, given your self-described newbie status, seems unlikely.)
其次,STATIC_URL的路径值不匹配别名
您已经把在httpd.conf - STATIC_URL具有 / logparseradmin /静/
,而别名
只是有 /静态/
Secondly, the path value of STATIC_URL doesn't match the Alias
you've put in httpd.conf - STATIC_URL has /logparseradmin/static/
, whereas Alias
just has /static/
三, ADMIN_MEDIA_ preFIX
应该是一个URL路径,而不是文件路径。
Thirdly, ADMIN_MEDIA_PREFIX
should be a URL path, not a file path.
和没有看到你的http.conf其余它不可能是肯定的,但有可能是第四个问题与处理您的别名之前的mod_wsgi匹配的URL。
And without seeing the rest of your http.conf it's impossible to be sure, but there may be fourth issue with mod_wsgi matching the URL before your Alias is processed.
这篇关于没有风格/ CSS在Django管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!