On 08/06/2010 09:54 AM, Alessandro Ronchi wrote:
I have always used a symbolic link to deploy with apache all my django
libraries media files.
But now I need a more solid way to deploy those files, without
concerning about symlinks I need to make after libraries install.
What solution do you use? Apache aliases?
As far as I know, it's not possible to serve static files from inside
an egg file. It would be very nice to pack a library (like, for
example, filebrowser), and have python unpack it on cache and serve
also javascript and image files.
Is it possible?
Yes, it is :-) Django-staticfiles is an application that can do it for
you. In DEBUG mode, django-staticfiles handles those files for you
directly. DEBUG=False, so in production: the "manage.py build_static"
grabs all your media files and puts them in a directory, ready for
apache to serve.
Behind the scenes, you have to have a /media directory in your
applications, just like that /template directory that's already there.
It basically works in the same way.
I've written a blog entry about it with some setup code and an example
apache config:
http://reinout.vanrees.org/weblog/2010/05/19/django-css-javascript-files.html
(http://tinyurl.com/377g9l9). Read it and you'll know if
django-staticfiles is what you're looking for.
Note: at djangocon.eu in Berlin, there were voices to make this
django-staticfiles solution standard in django 1.3.
Reinout
--
Reinout van Rees - rein...@vanrees.org - http://reinout.vanrees.org
Programmer at http://www.nelen-schuurmans.nl
"Military engineers build missiles. Civil engineers build targets"
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.