How to setup Amazon S3 in a Django Project?

Detailed tutorial with screenshots and code examples 
07 August 2017   2780

High-level, free and open source Python Web framework 

What is Amazon S3? 

Amazon Simple Storage Service (Amazon S3) is an online web service offered by Amazon, providing the ability to store and retrieve any amount of data, anytime from anywhere on the network, a file hosting. With the help of Amazon S3, high scalability, reliability, high speed and inexpensive storage infrastructure are achieved. First appeared in March 2006 in the US and in November 2007 in Europe.

Amazon S3 is used by many other services for storing and hosting files. For example, Dropbox and Ubuntu One, Twitter and, and even Minecraft uses it.

How to use Amazon S3 in Django Project? 

The Amazon S3 service can be used to handle static assets and the user uploaded files, that is, the media assets. 

In the tutorial, you will find three sections:

  • Working with static assets only
  • Working with static and media assets
  • Mixing public assets and private assets

Additionally, you will learn how to install Amazon S3

You will also need to install two Python libraries:

  • boto3
  • django-storages

The boto3 library is a public API client to access the Amazon Web Services (AWS) resources, such as the Amazon S3. It’s an official distribution maintained by Amazon.


Multi-paradigm programming language with easy-to-use syntax and many features

The django-storages is an open-source library to manage storage backends like Dropbox, OneDrive and Amazon S3. It’s very convenient, as it plugs in the built-in Django storage backend API. In other words, it will make your life easier, as it won’t drastically change how you interact with the static/media assets. 

Full tutorial is available at SimpleIsBettterThanComplex.

Django 2.2 to be Available

Good news - Django 2.2 is classified as a long-term issue and will receive updates until April 2022
02 April 2019   378

Django 2.2 web framework, written in Python and intended for developing web applications, is finally out. Django 2.2 is classified as a long-term issue and will receive updates until April 2022. LTS-branch 1.11 will be supported until April 2020, and branch 2.1 until December 2019. Support for branch 2.0 has been discontinued.

Key improvements:

  • New CheckConstraint and UniqueConstraint classes have been added that allow the model to define its own database access restrictions using the Meta.constraints option;
  • In the runserver, the Watchman framework is used to increase the performance of tracking changes in a large number of files;
  • Added an HttpRequest.headers object for quick access to HTTP headers sent during a request (for example, request.headers ['User-Agent']).