3

I have used saleor,django store and hosted it on google cloud, It is working fine. Now what I wanted to do is to host media files on S3 bucket. I have created a bucket and tried some tutorials but no success. I could not find any complete step by step guide for this. If anyone can help me with this problem it will be helpful.

AWS_ACCESS_KEY_ID = os.environ.get('accessid')
AWS_SECRET_ACCESS_KEY = os.environ.get('accesskey')
AWS_STORAGE_BUCKET_NAME = os.environ.get('testbucket')

I followed this guide for saleor S3 integration: https://saleor.readthedocs.io/en/latest/deployment/s3.html

Now here is the situation I have created the bucket and have AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY and AWS_STORAGE_BUCKET_NAME Can someone guide me from here how to serve media files on S3 for saleor

thirteen4054
  • 465
  • 4
  • 17

2 Answers2

1

The Saleor documentation is good but a little sparse. I had more luck following these instructions (read the installation section and then the S3 one -- this is the library Saleor is using anyways):

https://django-storages.readthedocs.io/en/latest/

I would start by configuring your local-running- app to use S3 for its static files and run python manage.py collectstatic for a tighter debugging loop.

Brendan W
  • 3,303
  • 3
  • 18
  • 37
  • I followed their documentation and also asked them, but the issue seems to be with `AWS_ACCESS_KEY_ID = os.environ.get('accessid') AWS_SECRET_ACCESS_KEY = os.environ.get('accesskey') AWS_STORAGE_BUCKET_NAME = os.environ.get('testbucket'` its not picking up the vaules. – thirteen4054 Aug 27 '18 at 12:34
  • Are you actually setting those values in the environment? Usually they'd be all caps. Like mine in heroku are called "AWS_ACCESS_KEY_ID" not "accessid" – Brendan W Aug 27 '18 at 19:19
  • is it safe to directly set them like this `AWS_SECRET_ACCESS_KEY=myaccesskey`? – thirteen4054 Aug 28 '18 at 17:46
0

After creating the bucket you have to update your media/static urls and also add your aws keys(I recommend adding them through env variable).

AWS_ACCESS_KEY_ID = os.environ.get('accessid') 
AWS_SECRET_ACCESS_KEY = os.environ.get('accesskey') 
AWS_STORAGE_BUCKET_NAME = os.environ.get('testbucket'

Once done now you need to setup the configuration of your bucket and thats it.

thirteen4054
  • 465
  • 4
  • 17