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.
/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':
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!
nearly 1 in 3 companies have no process for identifying, tracking,
or remediating known open source vulnerabilities
...
data presented on the Open Hub is available through our
API
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!
This site uses cookies to give you the best possible experience.
By using the site, you consent to our use of cookies.
For more information, please see our
Privacy Policy