• Members 2 posts
    July 30, 2020, 3:29 a.m.

    Hi Friends,

    I am trying to use "Amazon S3 Bucket" for storing the attachments uploaded in any post or reply.

    Misago is currently placing all the attachments inside /media/attachments/{{postId}}/{{hash code}}. We want to avoid this getting uploaded on our web server, and S3 buckets are a cheaper alternative.

    Could you please help us guiding with this?

    Regards,
    Anuj

  • arrow_forward
  • July 30, 2020, 11:29 p.m.

    Hi!

    This is actually possible to do.

    First, create file named requirements-plugins.txt in the same directory that contains requirements.txt (it should be misago). Inside this file put this line:

    django-storages
    

    Next, create settings_override.py file in same directory that contains settings.py (it should be misago/misagodocker). Fill its contents like this:

    DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
    
    AWS_ACCESS_KEY_ID = "YOUR AWS ACCESS KEY ID HERE"
    AWS_SECRET_ACCESS_KEY = "YOUR AWS SECRET ACCESS KEY HERE"
    AWS_STORAGE_BUCKET_NAME = "YOUR BUCKET NAME"
    AWS_S3_REGION_NAME = "YOUR REGION NAME"
    

    Remember to fill in valid values to AWS_ settings!

    Then, run ./appctl rebuild to rebuild your Misago site. After rebuild is complete, Misago should use S3 for uploads storage.