Tuesday, May 31, 2011

Re: How to I create download link of some file using django

Thanks for your help Ivo,

I have another question here. It seems that django.contrib.staticfiles
can be used to handle some static files during the 'debug' mode while
using the embedded 'runserver' from django. However, would it be
possible if I just develop my website using the system's Apache and
not using the django.contrib.staticfiles?

Kann

On May 31, 4:51 pm, Ivo Brodien <i...@brodien.de> wrote:
> > I am a bit confused about how to set the MEDIA_URL variable here.
> > Currently, I am testing the web using Django embedded webserver and
> > doesn't have a proper url yet. Should my MEDIA_URL be something
> > like...http://my_machine_name:8000/media/
>
> yes, but so in your template you do:
>
> > ### in the template ####
> > <a href="{{ MEDIA_URL }}{{ django_file.url }}>download</a>
>
> Your:> <a href="file:///{{ django_file.url }}>download</a>
>
> file:/// will only work on you machine, since file:/// is pointing to a local file

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment