Task #7190 (closed)
Extended static files handler investigation
Reported by: | atarkowska | Owned by: | atarkowska |
---|---|---|---|
Priority: | minor | Milestone: | OMERO-4.4 |
Component: | Web | Version: | n.a. |
Keywords: | n.a. | Cc: | web-team@… |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | 0.0d |
Sprint: | 2011-11-29 (3) |
Description
Investigation of how we want to use & reuse Django django.contrib.staticfiles app and how it make it easily extendible.
Change History (7)
comment:1 Changed 12 years ago by atarkowska
- Remaining Time set to 1
comment:2 Changed 12 years ago by atarkowska
- Cc web-team@… added
comment:3 Changed 12 years ago by atarkowska
- Status changed from new to accepted
comment:4 Changed 12 years ago by atarkowska
- Remaining Time changed from 1 to 0
- Resolution set to fixed
- Status changed from accepted to closed
comment:5 Changed 12 years ago by atarkowska
Referring to comments from the meeting 2011-11-14 above comment was updated.
comment:6 Changed 12 years ago by atarkowska
In order to take the adventage of static prefixes given template has to be rendered with a given context dictionary
from django.template import RequestContext return render_to_response(template_name, context_instance=RequestContext(request))
comment:7 Changed 12 years ago by atarkowska
Referring to the changes made in #7369 there is no longer need to create custom context processors for static aliases.
django.contrib.staticfiles collects static files from each of your applications (and any other places you specify) into a single location that can easily be served in production.
By default, static files should be put within static/ subdirectories of apps in INSTALLED_APPS. Some projects will probably also have static assets that aren’t tied to a particular app. The STATICFILES_DIRS setting is a tuple of filesystem directories to check when loading static files.
WARNING: In every inherited template any code outside blocks redefinitions is not executed. So in this case {% load webclient_tags %} has to be called inside each block.
or use context processor for setting "global" variable.
http://host:port/static/YOUR_APP/image/logo.jpg
http://host:port/static/common/javascript/jquery_1.4.2.js