Django Apache/mod_python Admin CSS not appearing with admin tables Django Apache/mod_python Admin CSS not appearing with admin tables django django

Django Apache/mod_python Admin CSS not appearing with admin tables


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?

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/

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.


I used to have the same problem and the following entry in the http.conf worked fine with me:

<Directory "Path-to-python/Lib/site-packages/django/contrib/admin/media/">     AllowOverride None     Options None     Order allow,deny     Allow from all </Directory> Alias /media/ "Path-to-Python/Lib/site-packages/django/contrib/admin/media/"<Location "/mysite/">    SetHandler python-program    PythonHandler django.core.handlers.modpython    SetEnv DJANGO_SETTINGS_MODULE mysite.settings    PythonOption django.root /mysite    PythonInterpreter mysite    PythonDebug On    PythonPath "['C:/Python/Django/apps'] + sys.path"</Location>


Here is my django-specific apache configuration. Note, django handles every incoming url to the site (location /) except media, where it's disabled, and the data is served from django's media directory.

<Location "/">  SetHandler python-program  PythonHandler django.core.handlers.modpython  SetEnv DJANGO_SETTINGS_MODULE mysite.settings  #PythonOption django.root /  PythonDebug On  PythonPath "['e:/dj'] + sys.path"</Location>Alias /media  e:/dj/django-trunk/django/contrib/admin/media/<Location "/media">  SetHandler None</Location>