# How to set up AWS S3 in Django?

In **Django,** we can use **AWS S3** for two common things:

- For user uploaded files/images
- For Django static files

Before we cover both the use cases, let’s install a third party package, we’ll be using this third party package named `django-storages` in this blog.

# Let’s install:

```bash
pip install django-storages
```

# For user uploaded files/images:

Put this code in your **project’s** `settings.py` file:

```bash
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

# AWS Credentials 

AWS_ACCESS_KEY_ID = "PASTE IT HERE"

AWS_SECRET_ACCESS_KEY = "PASTE IT HERE"

AWS_STORAGE_BUCKET_NAME = "PASTE IT HERE"
```

# For Django static files:

For storing the **Django** static files in S3 bucket, the procedure is same as above, you just have to add this extra **config** in your `settings.py` file.

```bash
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3StaticStorage'
```

And you are good to go now, run the `collectstatic` command.

***Any doubts? Write it down in the comments.***

> ***For more such crispy blogs daily, follow Dev.Junction, subscribe to our newsletter and get notified.***
> 

## Social Links

- **LinkedIn:** [https://www.linkedin.com/in/mnamegaurav/](https://www.linkedin.com/in/mnamegaurav/)
- **YouTube:** [https://www.youtube.com/c/devjunction](https://www.youtube.com/c/devjunction)
- **Website:** [https://gaurav.devjunction.in/](https://gaurav.devjunction.in/)
- **GitHub:** [https://github.com/mnamegaurav](https://github.com/mnamegaurav)
- **Instagram:** [https://www.instagram.com/mnamegaurav/](https://www.instagram.com/mnamegaurav/)
- **Twitter:** [https://twitter.com/mnamegaurav](https://twitter.com/mnamegaurav)
