how to access binary file which is outside project folder

14 views
Skip to first unread message

sam kavuri

unread,
Feb 28, 2018, 8:36:36 AM2/28/18
to Django users
I am new to Django and trying to access binary file which is outside project folder and open it in the browser.

When i try to do that it is saying Cross-Origin Request is blocked (Reason: CORS header 'Access-Control-Allow-Origin missing).

Somebody, please help on this.

Andréas Kühne

unread,
Feb 28, 2018, 10:17:54 AM2/28/18
to django...@googlegroups.com
Hi,

You shouldn't be doing that at all. If you want the file to be accessable you need to include it in your media folder in the project - that's per design.

The way django (and all other frameworks) work is to make sure that only the items present in the application should be allowed. Even if you COULD use for example "file://home/andreas/file.pdf" as a link, it wouldn't work on anything else but YOUR machine, because that points to YOUR harddrive and nowhere else.

Regards,

Andréas

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django...@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/e74586f4-4831-4779-bf98-4d36221bee57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages