0

I am a newbie to DevOps and deployment. I have created a CMS in Django which has an image upload option. The application is already deployed on Heroku and it uses Postgres database. I then got to know that Heroku is an ephemeral filesystem and all my images uploaded will be lost. So I need to connect it with S3 for image storage.

Can anyone give the exact minimal code specifics? I have searched and tried many tutorials but none of it seem to work completely. This might be silly question but please help. I'm a newbie.

Keerthan Bhat
  • 314
  • 2
  • 15

3 Answers3

1

Why rediscover the wheel if you have multiple django bundles made for this?

All of these resources come with code examples.

Simas Joneliunas
  • 2,890
  • 20
  • 28
  • 35
  • These resources directly uploads the files to S3. But I need to do some image pre-processing before uploading to S3. – Keerthan Bhat Jul 11 '18 at 07:26
  • That is way too specific question to answer here. Image preprocessing is a separate issue from image uploading, unrelated with your original question. Also, you did not provide any details what kind of preprocessing you need to do for the images. Hence, it is impossible to help you further. – Simas Joneliunas Jul 11 '18 at 09:24
0

s3 storage create account in amazon.com

https://us-west-2.console.aws.amazon.com/console/home?nc2=h_m_mc&region=us-west-2

in s3 create bucket

https://console.aws.amazon.com/iam/home?region=us-west-2#security_credential

take the access key

then do all the step here https://devcenter.heroku.com/articles/paperclip-s3

Let me know if this does work :)

nourza
  • 2,215
  • 2
  • 16
  • 42
0

If you're using Django, the simplest way to upload files to S3 is to use django-storages library.

https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html

Abhishek Poojary
  • 749
  • 9
  • 10