简体   繁体   English

使用Heroku和Django和Images设置S3

[英]Setting Up S3 with Heroku and Django with Images

so I currently have my static files (js and css) just being stored on Heroku which is no biggie. 所以目前我的静态文件(js和css)只是存储在Heroku上,这没什么大不了的。 However, I have objects that I need to store multiple images too and be able to get those images on request. 但是,我还有一些对象,我也需要存储多个图像,并且能够根据要求获取这些图像。 How would I store a reference to those images? 我将如何存储对这些图像的引用?

I was planning to use a S3 Direct File Upload using these steps on Heroku here . 我打算在此处Heroku上使用这些步骤来使用S3直接文件上传。 Is this also going to be the best way for me to do so? 这也是我这样做的最佳方式吗?

Thank you in advance. 先感谢您。

I don't think setting up static (css,js,etc..) or media (images, videos) to be stored on S3 has anything to do with Heroku or where you deploy. 我认为设置静态(css,js等)或媒体(图像,视频)以存储在S3上与Heroku或部署位置无关。 Rather, its just making sure Django knows where to save the files, and where to fetch them. 相反,它只是确保Django知道在哪里保存文件以及在哪里获取文件。 I would definitely not follow that link, because it seems confusing and not helpful when working with Django. 我绝对不会遵循该链接,因为在使用Django时,它似乎令人困惑且无济于事。

This tutorial has really helped me, as it will show you how to set all of that up. 本教程确实对我有所帮助,因为它将向您展示如何进行所有设置。 I have gone through these steps and can confirm it does the trick. 我已经完成了这些步骤,并且可以确认它能解决问题。 https://simpleisbetterthancomplex.com/tutorial/2017/08/01/how-to-setup-amazon-s3-in-a-django-project.html https://simpleisbetterthancomplex.com/tutorial/2017/08/01/how-to-setup-amazon-s3-in-a-django-project.html

While I've gone this route in the past, I've recently opted to use Digital Ocean's one-click app - Dokku . 虽然过去我一直走这条路线,但最近我选择使用Digital Ocean的一键式应用程序Dokku It's based on Herokuish . 它基于Herokuish I then use Dokku's persistent storage to take advantage of the 25 gigs of storage on DO's smallest, $5/month, plan. 然后,我使用Dokku的持久性存储来利用DO最小的,每月5美元的计划中的25个存储空间。 I wrote a guide to this here . 在这里写了一个指南。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM