Django的阿帕奇/ mod_python的联系CSS无法与管理表出现 [英] Django Apache/mod_python Admin CSS not appearing with admin tables
问题描述
我的Windows XP / Django的/阿帕奇/ mod_python的本地主机上运行。所有部件都与管理CSS的例外而不是渲染工作。管理工作,但没有任何HTML格式。我在做加法:
I have Windows XP/Django/apache/mod_python working on localhost. All parts are working with the exception of the admin CSS not rendering. The admin works, but no html formatting. I've made additions in:
settings.py
INSTALLED_APPS
'django.contrib.admin',
urls.py
from django.contrib import admin
admin.autodiscover()
(r'^admin/(.*)', admin.site.root),
conf/http.conf
<Location "/">
SetHandler python-program
PythonPath "['C:/django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
</Location>
<Location "/cpssite/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myapplication.settings
PythonInterpreter /myapplication
PythonDebug On
</Location>
我难倒。是否有更多的code我应该加什么地方?
I'm stumped. Is there more code I should have added somewhere?
推荐答案
请问您ADMIN_MEDIA_ preFIX存在吗?它是从不同MEDIA_URL?你后面的斜线?就是Apache处理,正确服了管理媒体?
Does your ADMIN_MEDIA_PREFIX exist? Is it different from MEDIA_URL? Did you include the trailing slash? Is Apache handled to correctly serve up the admin media?
默认的Django配置有位于管理员媒体{Django的安装目录} /的contrib /管理/媒体。 ADMIN_MEDIA_ preFIX默认为/媒体/。所以,你需要像这样添加到您的Apache配置:
The default Django configuration has the admin media located at {Django install dir}/contrib/admin/media. ADMIN_MEDIA_PREFIX defaults to /media/. So you need to add something like this to your Apache config:
Alias /media/ /path/to/django/contrib/admin/media/
这将告诉Apache的请求为mysite.com/media/css/whatever.css的意思来提供/path/to/django/contrib/admin/media/css/whatever.css,这应该解决您的问题。
This will tell Apache that requests for mysite.com/media/css/whatever.css mean to serve up /path/to/django/contrib/admin/media/css/whatever.css, which should solve your issue.
这篇关于Django的阿帕奇/ mod_python的联系CSS无法与管理表出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!