0
I Use This!
Activity Not Available

Project Summary

Many times one would like to ship media (images, javascript, css, etc.) with a reusable django app (and many do). This can cause a number of problems for setting up the production and dev servers to serve up this data. Often this includes copying files, and editing templates to point to the new location somewhere under the MEDIA_ROOT.

appmedia solves these problems with: 1. template tags for generating the urls 2. httpd.conf directive generation 3. symlink generation (if you don't like option #2) 4. media serving under the dev server 5. settings.py overrides on multiple levels

A reusable app should have a 'media' directory under it containing the media to be served (just like the django admin contrib app). This media directory can be overridden as described below. Reusable applications need not come with a media directory for appmedia to be used with them. In this way you can write smart templates and manage the media for each app cleanly.

There are two main template tags:

{% app_media_prefix "myapp" %}img/foo.jpg
{% app_media_url "other.app" "img/bar.jpg" %}Which could render as:

/media/myapp/img/foo.jpg
/media/other/app/img/bar.jpg?m=47fd0011and be mapped to the file locations

/usr/username/projects/apps/myapp/media/img/foo.jpg
/usr/username/eggs/other-1.0.egg/other/app/media/img/bar.jpgThe app_media_url tag will append the files modification time in hex form to the url to help with caching behaviors (quite useful for CSS).

appmedia creates an index of on disk media directories and the associated urls. These can then be used in the appmedia template tags.

Directory backoff given an app module of 'app.name':

settings._MEDIA_ROOT
settings._MEDIA_URL
settings.APP_MEDIA_ROOT + '/'
settings.MEDIA_ROOT + '/'
settings.APP_MEDIA_ROOT + '/'
settings.MEDIA_ROOT + '/'
'/media/'URL backoff given an app module of 'app.name':

settings._MEDIA_URL
settings._MEDIA_URL
settings.APP_MEDIA_URL + '/'
settings.MEDIA_URL + '/'

if settings.APP_MEDIA_ALLOW_FILE_URL:
# for dev server use only.
'file://'
else:
raise ImproperlyConfigured, msg

Tags

django media static

In a Nutshell, django-appmedia...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

BSD 4-clause (University of California-Specific)
Permitted

Place Warranty

Commercial Use

Modify

Distribute

Forbidden

Hold Liable

Use Trademarks

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    you can subscribe to e-mail newsletters to receive update from the Open Hub blog
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    anyone with an Open Hub account can update a project's tags

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis