Just for posterity, I wanted to note how I got css to work, both in my
html files and my Django admin files, when using Django under Apache
on Windows.  My discoveries were a bit different than pacman's, but
this thread was very helpful and I wanted to give something back. :)

For me, it was a 4 step process.
1. Tell Apache to map webpaths to filesystem paths.
2. Tell Apache it's okay to access those filesystem paths.
3. Tell Apache not to use a handler for those webpaths.
4. Tell Django to use those webpaths for admin css files.

The long version follows-

1. Add some alias paths in the apache conf.  Since django's
settings.py file expects to see web paths, you need to use apache's
alias_module settings to map webpaths [using names of your choosing]
into the filesystem paths where you want to direct django to look for
css files.

<IfModule alias_module...
# (my chosen alias for a path towards my chosen css dir)
Alias /webpath "C:/Intranet"
# (my chosen alias for a path towards django's given admin css dir)
Alias /django_admin "C:/Python25/Lib/site-packages/django/contrib/
admin"
</IfModule>

2. The apache IfModule section has some recommendation comments around
the Alias: section about adding <Directory> sections to allow access
to the directories.  Follow those recommendations by adding the
following to explicitly tell apache to allow access to the filesystem
paths from step 1.

<Directory "C:/Intranet">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory "C:/Python25/Lib/site-packages/django/contrib/admin">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

3. Using django's recommended Location directives in apache's conf,
set handlers to None for the css webpaths.

# (my chosen alias from step 1, suffixed with my css dir)
<Location "/webpath/css">
SetHandler None
</Location>

# (my chosen alias from step 1, suffixed with django's css dir)
<Location "/django_admin/media">
SetHandler None
</Location>

4. Tell django the webpath to use when looking for it's admin media
(css) files.

ADMIN_MEDIA_PREFIX = "/django_admin/media/"

There is no need to tell django about my own css files, since I
describe them within my html files - <link href="/webpath/css/
myfile.css" rel="stylesheet" type="text/css" />

Good luck to those who follow...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to