Book Image

Building Serverless Python Web Services with Zappa

By : Abdulwahid Abdulhaque Barguzar
Book Image

Building Serverless Python Web Services with Zappa

By: Abdulwahid Abdulhaque Barguzar

Overview of this book

Serverless applications are becoming very popular these days, not just because they save developers the trouble of managing the servers, but also because they provide several other benefits such as cutting heavy costs and improving the overall performance of the application. This book will help you build serverless applications in a quick and efficient way. We begin with an introduction to AWS and the API gateway, the environment for serverless development, and Zappa. We then look at building, testing, and deploying apps in AWS with three different frameworks--Flask, Django, and Pyramid. Setting up a custom domain along with SSL certificates and configuring them with Zappa is also covered. A few advanced Zappa settings are also covered along with securing Zappa with AWS VPC. By the end of the book you will have mastered using three frameworks to build robust and cost-efficient serverless apps in Python.
Table of Contents (20 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Setting up static and media files


Configuring the static and dynamic files in Django is essential. How we configure and serve static and media files does impact on the overall performance of the application. Hence, configuring the static and media files should be taken care of in an optimized way. Let's have a detailed discussion about it.

Standard configuration

Django has a standard pattern to configure the static and media files. Static and media are two different concerns, where static files refer to fixed content, such as HTML, JS, CSS, and images. Django defines some configuration related to static files in settings.py and URL configured in urls.py. Media files refer to any files that are handled dynamically by uploading. Django has a very good mechanism to configure and manage static HTML, JS, CSS, and images files.

Normally, the default Django static file configuration assumes that you will have static files along with your code base under a static directory, but, in our case, we want...