serving static files (was: How to create a project?)
martin f krafft
madduck at madduck.net
Tue Feb 2 17:03:38 EST 2010
also sprach Jeremy Kerr <jk at ozlabs.org> [2010.02.02.1050 +1300]:
> > and there seems to be absolutely no CSS layout.
>
> You'll need to have configured your web server to handle the static files
> itself. I have the following setup for patchwork.ozlabs.org:
>
> RewriteEngine On
> RewriteCond %{REQUEST_URI} !^/(images|css|js|media)/.*
> RewriteCond %{REQUEST_URI} !^/robots.txt
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule ^/(.*)$ /patchwork.fcgi/$1 [QSA,L]
Well, except the default urls.py sets up django.views.static.serve
for most of those, except media. However, since this is likely not
very performant, I use apache2 Aliases:
Alias /images/ "/srv/patchwork/htdocs/images/"
Alias /css/ "/srv/patchwork/htdocs/css/"
Alias /js/ "/srv/patchwork/htdocs/js/"
Alias /robots.txt "/srv/patchwork/htdocs/robots.txt"
<Directory "/srv/patchwork/htdocs">
Order allow,deny
Allow from all
</Directory>
Alias /media/ "/usr/share/python-support/python-django/django/contrib/admin/media/"
<Directory "/usr/share/python-support/python-django/django/contrib/admin/media/">
Order allow,deny
Allow from all
</Directory>
The problem was that I had /admin/media there in the site I used to
bootstrap the WSGI configuration, probably to avoid namespace
pollution.
Works now, thanks.
I sent an update to the patch in
<1264902001-30643-4-git-send-e-mail-madduck at madduck.net> just now.
--
martin | http://madduck.net/ | http://two.sentenc.es/
"never try to explain computers to a layman.
it's easier to explain sex to a virgin."
-- robert heinlein
(note, however, that virgins tend to know a lot about computers.)
spamtraps: madduck.bogus at madduck.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20100202/94a2d81c/attachment.pgp>
More information about the Patchwork
mailing list