How do I get Django to see the folders on my computer?

Asked

Viewed 73 times

1

I need to make my system see folders that are outside your folder, to render the . pdfs that are inside those folders. I’m using a function in javascript (Vue.js) very simple, similar to this one:

get_doc(doc_name) {
  return '/static/pdf_docs/' + doc_name;
}

Only that, besides being inelegant, forces me to leave all . pdf files in Static folder. I tried some procedures but could not. Thanks for your help.

  • you configured the media?, usually one uses a dedicated server to serve these types of files

  • @Daviwesley, as I am a beginner in Jango, did not know that it was necessary to make this configuration. Could provide an example of how I can do?

  • 1

    sorry for the delay, so I’ve never done it in Django but I believe it’s very easy, have a tutorial that shows a simple example of how to do this.

2 answers

0

Generally is not advised to use Django to serve files in production, use a dedicated server such as Nginx.

Most major sites Django uses a separate web server - that is, one that is not also serving Django - to serve static files. This server runs a different type of web server - faster but without so many features

however, if you want to do this in Django it offers this functionality, on ONLY in English has an example of how to do this step by step :)

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.