Re: Links to files

2018-01-06 Thread Jani Tiainen
If those files are really static you don't need Django to serve them (maybe
on development phase). You shouldn't put those files in static files if
files are not really static (created before your app is ever launched). If
you create files on the fly, you probably better to serve them as a media
files ("user uploaded files") and just hookup your front end webserver to
serve those files.

There is a very short section in Django docs which tries to explain how
MEDIA_URL and MEDIA_ROOT works (similar as STATIC_URL and STATIC_ROOT but
for different purpose)

https://docs.djangoproject.com/en/2.0/topics/files/

On Fri, Jan 5, 2018 at 6:50 PM, Karl Ritchie  wrote:

> Hi I'm very new to Django. I tried searching for this but the answers I
> found aren't very clear. I'm wanting to create links to PDF documents.
> I've created an app called writing with a static folder with PDF files. At
> first I just put an html  link in the template file but it when I ran it it
> said it couldn't find the file.
> I think I have to change the View.py and URL.py in Writing but what do I
> change it to and what do I put in the template file for the link?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/dcd1a1fc-3aac-4562-a8c3-159b846a44c0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oeqj-vSgQ36MLcmWhtS3Oq5V-vJo2y-p0iiYnSh7N%2B4ew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Links to files

2018-01-05 Thread Matemática A3K
On Fri, Jan 5, 2018 at 1:50 PM, Karl Ritchie  wrote:

> Hi I'm very new to Django. I tried searching for this but the answers I
> found aren't very clear. I'm wanting to create links to PDF documents.
> I've created an app called writing with a static folder with PDF files. At
> first I just put an html  link in the template file but it when I ran it it
> said it couldn't find the file.
> I think I have to change the View.py and URL.py in Writing but what do I
> change it to and what do I put in the template file for the link?
>
>
Karl,

"A static file is a static file", it doesn't matter if it is a jpg or a
pdf. You should read
https://docs.djangoproject.com/en/2.0/howto/static-files/ and think that
instead of img tags for jpgs you will use a tags for pdfs

HTH!


>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/dcd1a1fc-3aac-4562-a8c3-159b846a44c0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BFDnh%2Bjz9SSTyivi3DmuY7ZDAbz8rSJbZS7sxocuao%2BZ6F0cQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Links to files

2018-01-05 Thread Karl Ritchie
Hi I'm very new to Django. I tried searching for this but the answers I 
found aren't very clear. I'm wanting to create links to PDF documents.  
I've created an app called writing with a static folder with PDF files. At 
first I just put an html  link in the template file but it when I ran it it 
said it couldn't find the file.
I think I have to change the View.py and URL.py in Writing but what do I 
change it to and what do I put in the template file for the link?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dcd1a1fc-3aac-4562-a8c3-159b846a44c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.