django-media-utils 0.1.0

Django utilities for managing static assets
django-media-utils contains utilities for managing static files in Django projects.<br /><br /><strong>The serve_app_media view</strong><br /><br />Serve static assets from media folders in all installed apps in development.<br /><br />To use, add something like this to your root URLconf:<br /><br /><em>if DEBUG:<br /> (r'^media/(?P.+)$', 'media_utils.views.serve_app_media')</em><br /><br />The files in my_app/media/ will then be available at the media/ URL as if they were located at MEDIA_ROOT. Files actually at MEDIA_ROOT take precedence, then apps are checked in order of INSTALLED_APPS listing. This is analogous to the app_directories template loader.<br /><br />A common convention is to place your app's static files under my_app/media/my_app/, in which case they will be served at the URL /media/my_app/.<br /><br />This view is intended for use in development only. Properly configure your webserver to serve media in production (see the link_media management command below).<br /><br /><strong>The link_media management command</strong><br /><br />When you move your site into production, you will want your webserver to serve static files directly off the filesystem, not through Django. If you have media in several reusable apps, it can be a pain to manually set up symlinks or webserver alias directives to mimic the functionality of the serve_app_media view.<br /><br />The link_media management command automatically creates symbolic links to all your media files, including files in application directories, from a webserver directory that you specify. For instance:<br /><br /><em>./manage.py link_media /var/www/my_site_media</em><br /><br />This will create symbolic links in the my_site_media pointing to all of your static files. Name clashes are resolved with the same priority order as in the serve_app_media view: files in the project MEDIA_ROOT take precedence, followed by app files in INSTALLED_APPS order.<br /><br />link_media is non-destructive by default: it will not remove or alter existing files or symbolic links in the specified directory. If you pass it the --clean option, it will first remove all files and subdirectories in the specified directory before creating its symbolic links. Be careful with this option!<br /><br />Obviously this command is only useful on operating systems which support symbolic links.<br /><br />Please report bugs to the official home page: <a href="http://launchpad.net/django-media-utils">http://launchpad.net/django-media-utils</a><br />

last updated on:
June 30th, 2009, 3:20 GMT
price:
FREE!
developed by:
Carl Meyer
license type:
BSD License 
category:
ROOT \ Internet \ HTTP (WWW)

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Add your review!

SUBMIT