How to setup Amazon S3 in a Django Project?

Detailed tutorial with screenshots and code examples 
07 August 2017   1050

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.0 beta available now

Beta version of new major release of popular Python framework out now
17 October 2017   685

Great news for Python developers and Django fans. Beta version of Django 2.0 out now. 

What's new in Django 2.0 beta? 

  • Simplified URL routing syntax
    • The new django.urls.path() function allows a simpler, more readable URL routing syntax. For example, this example from previous Django releases:
      • url(r'^articles/(?P<year>[0-9]{4})/$', views.year_archive),
    • could be written as:
      • path('articles/<int:year>/', views.year_archive),
  • Mobile-friendly contrib.admin
    • The admin is now responsive and supports all major mobile devices. Older browser may experience varying levels of graceful degradation
  • Window expressions
    • The new Window expression allows adding an OVER clause to querysets. You can use window functions and aggregate functions in the expression.
  • Removed support for bytestrings in some places
    • To support native Python 2 strings, older Django versions had to accept both bytestrings and unicode strings. Now that Python 2 support is dropped, bytestrings should only be encountered around input/output boundaries (handling of binary fields or HTTP streams, for example). You might have to update your code to limit bytestring usage to a minimum, as Django no longer accepts bytestrings in certain code paths.

Python compatibility

Django 2.0 supports Python 3.4, 3.5, and 3.6. Developers highly recommend  and officially support the latest release of each series.

The Django 1.11.x series is the last to support Python 2.7.

Django 2.0 will be the last release series to support Python 3.4. If you plan a deployment of Python 3.4 beyond the end-of-life for Django 2.0 (April 2019), stick with Django 1.11 LTS (supported until April 2020) instead. Note, however, that the end-of-life for Python 3.4 is March 2019.

Learn more at official release notes

You can download Django 2.0 beta at official website