On 1/14/06, Greg <[EMAIL PROTECTED]> wrote:

your folder structure. This issue seems especially pertinent for Django
because although the mechanism for assembling several apps together on
one server is a sweet way to make it easy to combine and reconfigure
applications, having to specify a single global MEDIA_ROOT/MEDIA_URL
kind of limits it. You can't just put static files in the same
directory as the template files, like JSP developers (for instance)
often do. It'd be convenient if each app had "media" subdirectory or
something to go with its models, views, and templates. And actually,
the admin app is an excellent example of this! But admin has to have
its own special setting (ADMIN_MEDIA_PREFIX) and handler to make it
work. Is there any suggested strategy for how other apps can have their
own media directories too? What's the common practice?

 Static files are best served by basic http servers and not django. Django tries to support serving static files, but that is only for convenience in development. Just now I finished deploying a django project under mod_pythong/apache, and my approach was to setup a /static url pointing to a directory containing static files and I setup django's static file serving view for that, I did that till the development lasted, and then I moved it to apache, and put a:
<Location "static">
     SetHandler None
</Location>
like directive in apache conf to bypass django for them. I have setup apache to server / using django. /static contained directores for different application, modified ADMIN_MEDIA_PREFIX to point to this location, and developed my other application assuming my static files will be available at /static/myapp/.

The only thing I am missing in this approach is: my 404 views are not called when some file is unavailable, and ugly looking apache default comes up. I can change apache's 404 page to someother, but it seems it has to be static html file, not explored it much, but then its not really too bad.

--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701

Reply via email to