Hi Erik, Ok this did something now. Instead of a 404 page not found on server message I am getting a "403 Forbidden" "You don't have permission to access /media/test.js" on this server. I have checked my file and directory permissions which all seem fine all the way thorugh /var/www/ django_projects/proj_name/media. Any suggestions? If not, many thanks for all your help anyway.
Huw On Oct 13, 11:35 am, Erik Allik <[EMAIL PROTECTED]> wrote: > Just use RequestContext instead of Context when passing context to > templates to be rendered. > > Like: > > return render_to_response("my_app/my_template.html", {"some_var": > "foo"}, > context_instance=RequestContext(request)) > > or: > > return render_to_response("my_app/my_template.html", > RequestContext(request, {"some_var": "foo"}) > > And yes, Alias is the way to go in Apache configuration. Probably > mod_rewrite would work, too. > > Erik > > On 13.10.2008, at 13:20, huw_at1 wrote: > > > > > Hi Erik, > > > Many thanks for your reply. This is somewhat more complicate dthan I > > had hoped. Does this mean I am going about this the wrong way and that > > there is a simpler way? If not then is Alias a command I use from > > within the apache conf file? Also how do I check if I have the request > > context processor activated and also do I need to pass the MEDIA_URL > > value into the template from the views/urls? > > > Many thanks again > > > Huw > > > On Oct 13, 10:54 am, Erik Allik <[EMAIL PROTECTED]> wrote: > >> First of all, you should set MEDIA_URL to '/media/' and Alias /media > >> as /var/www/django_projects/proj_name/media/ or use mod_rewrite. Then > >> you should instead request for {{ MEDIA_URL }}test.js not the > >> hardcoded /media/test.js. This requires that you have request context > >> processor activated and MEDIA_URL is available in the template > >> context. > > >> Erik > > >> On 13.10.2008, at 12:34, huw_at1 wrote: > > >>> Hi there. I have a website running out of django on my apache/ > >>> mod_python web server. When trying to link javascript to my > >>> templates > >>> such as: > > >>> <script src="/media/test.js"> > > >>> I keep getting a 404 error stating that "/media/test.js was not > >>> found > >>> on this server". > > >>> I have the test.js file located at "/var/www/django_projects/ > >>> proj_name/ > >>> media/test.js". So I have set MEDIA_ROOT to be '/var/www/ > >>> django_projects/proj_name/media/' and my MEDIA_URL to be '/'. Also I > >>> have set <Location "/media"> in my apache conf file to be > >>> "SetHandler > >>> None" to prevent django proceesing media URLs. I can't think what > >>> else > >>> I am missing but for some reason my media files such as "test.js" > >>> are > >>> not being found. I'd appreciate it if anyone could offer any > >>> advice on > >>> this. > > >>> Many thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---