Can I get an S3 bucket allocated for my app?

I’d like to request an S3 bucket for app 12838. How do I get one?

Hi @austin, thanks for writing in!

Your app has two environments: staging and production. Please clarify whether you are referring to the staging or the production environment and I’ll be happy to provide the necessary configuration.

Logic would say, both. :wink:

Thanks for clarifying, @austin.

I’ve gone ahead and added the AWS credentials to your production environment (your staging environment has already had these configured before). Please use the following environment variables in order to configure the S3-based storage:

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
AWS_STORAGE_REGION


@dmitrii.k

Should they show up in our Dashboard? I do not see them?

@austin, this is completely normal - these variables are hidden from the CB Dashboard and are available only to the running application.

Let me know if you need any further help and have a great day!

Thank you @dmitrii.k I appreciate all your help!

@dmitrii.k

Actually, the bucket name is not provided and we are getting an error

Thank you @dmitrii.k I appreciate all your help!

You are always welcome.

Actually, the bucket name is not provided and we are getting an error

Since you have a collectstatic command running during build of your Docker image it loads the app configuration, which depends on the environment variables that are normally not available during build. Please make sure you’re providing a default value when getting these variables from the environment, i.e. env.str("AWS_STORAGE_BUCKET_NAME", ""), so it’s possible to run your app both during build and locally where in both of these cases you don’t have these variables available.

Hi @dmitrii.k Django media stores files using static storage settings, which in our case is S3.

Locally I run without any issues using different settings file using standard Django storages.

@naveen.vasudevan thanks for clarifying your problem.

Please make sure that you use different storage backends for STATICFILES_STORAGE, e.g. whitenoise storage backend (whitenoise.storage.CompressedManifestStaticFilesStorage), standard file storage backend (django.core.files.storage.FileSystemStorage), etc., and DEFAULT_FILE_STORAGE, which in your case would be the Boto S3 storage backend - storages.backends.s3boto3.S3Boto3Storage.

Let me know if you need any more help on this.

I configured white noise now, and the build succeeded! Thanks for your help :slight_smile:

1 Like

You are most welcome, @naveen.vasudevan.

Please reach out again if you need any more assistance.