How can I setup Django to serve files on a file server?

136 views Asked by At

I am working on a Django website where files are going to be sold. These files can be large in size, up to 5GB. So, I believe that in addition to a VPS for serving the website, I also need to set up a file server (download server).

First of all, since I haven't used download servers before, I'm unsure about how to connect the download server to the VPS that hosts my website. In my research, I've come across the idea of setting up a subdomain. For instance, if my website is mywebsite.com, I would create a new DNS A record, like dl.mywebsite.com, and then use this link to serve the files to users on my website. Is this a correct approach? And also what protocol should be used for this connection when a user clicks a download button? Is it going to be a file protocol, HTTP, FTP, or something else?

Another question is that I have no idea how to configure my Django project to provide download links to users who have purchased a file when the files are located on another server. For example, how do I configure the media root and URL so that the file is read from the file server, allowing users to download it from there?

Also a product may contain one or more files. How can these files be uploaded to the file server, which is separate from the web server, via the Django admin panel without using an FTP client? Is it possible to use an FTP client to upload the files and then attach them to a single product in Django admin panel?

Lastly, do I need to create a separate view to serve the files, or is it okay to simply use an <a href="file url" download> element?

Thank you for any guidance and advice.

0

There are 0 answers