I've been a semi-active participant in the Django community for over a year now. I've seen thousands of e-mails come through on the Django-users and Django-developers list. I've written a few patches, and helped revise some as well. I may not be the most seasoned Django community member, but I see the same questions pop up fairly frequently. Here are some of the solutions to some of those problems, and some helpful ideas that may be helpful. This is no substitution for the official docs. All of this is documented very well at http://docs.djangoproject.com/en/dev/howto/static-files/
Static media seems a little weird if you're new to web frameworks. It seems like Django should be responsible for serving that media. It shouldn't be. It can, however, be useful in some instances. Many questions about serving static files fall into two categories.
The first question is "How do I make Django serve static files?" The answer is to use the django.views.static.serve view. This answer comes with a caveat: don't do it in production. Django isn't designed nor optimized to serve these files. In production you should use your regular web server to serve static files. The second question is "How do I make my production server x serve static files when I am using Django?" This question is very specific to the webserver in question. Basically you configure your webserver to use its default handler for a specific directory. In apache this is NoHandler. This is commonly used in conjunction with an alias directive to point that particular location to the directory storing the static files.
Another question that comes up from time to time surfaces because the Django dev server returns 404s after configuring the django.views.static.serve view on the /media URL. This is because the default url for the admin media is /media. The way to fix this is to make sure that your static file view is set to a location that is different from ADMIN_MEDIA_PREFIX. One way to fix this is to set ADMIN_MEDIA_PREFIX to /media/admin. The Django dev server automatically takes care of the url pattern for the admin media files. You don't need to do anything other than change your value in settings.py.
It would be pretty nice to be able to have Django serve your own static media automatically when you run the dev server. This is done with the AdminMediaHandler middleware that is automatically used when the development server is run. One way to implement similar functionality is to add this to your urls.py:
if settings.DEBUG:
if settings.MEDIA_URL.startswith("/"):
M = MEDIA_URL[1:]
urlpatterns += patterns('',
(r'^' + M + '(?P<path>.*)$','django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
)
This won't work nearly as well as the AdminMediaHandler, and it will break if you don't use a trailing slash in settings.MEDIA_URL. To be completely useful, you'll need to use the a RequestContext when rendering your templates that makes MEDIA_URL available to them. That way, you can change /meda/ to /monkeys/ on a whim, and nothing will break. This is definitely in line with the DIY philosophy.
It is useful because it'll be run when you have DEBUG set to True. You shouldn't have DEBUG set to true in a production environment, so it's logical to use that as a check. Some may disagree, but I find this method to be satisfactory.