Serving Static Files in Python With Django, AWS S3 and WhiteNoise

python_tutorials

Introduction

Websites generally need additional files such as images, CSS, and JavaScript files that are necessary to render complete web pages in a browser. In small projects, we can work our way around by providing absolute paths to our resources or by writing inline CSS and JavaScript functions in the HTML files. This is not only against the best coding practices but it also gets tricky when we are handling bigger projects, especially with multiple applications.

In Django, the files required for interactive user experience, presentation of documents, and functional web pages are called static files.

In this article, we will see how we can deal with multiple sets of static files provided by each application to customize the look and feel of a website.

Configuring Static Files

Django provides tremendous flexibility on how you can serve the static files. We will cover using

To finish reading, please visit source site