Serverless Django with Zappa
Learn how to migrate your Django application to a serverless environment hosted by AWS Lambda.
What You Will Learn
How to migrate your Django project to the AWS serverless environment
Adapt your code to changes necessary for running in the cloud
How to setup a reliable and consistent local development environment for serverless projects
How to setup and connect to a hosted RDS database
Learn about setting AWS IAM permissions for serverless projects
How to map a custom domain name to your Django project
Effectively serve Django static files via S3 or AWS Lambda
How to navigate the AWS Console to host multiple domain names
Learn about setting up a secure network environment using AWS VPC
Whether you are a solo developer working on your next startup idea or a team of folks working with Django, this course shows you the way to simplify your operations overhead while saving money. The open source Zappa utility paves the way to migrate your Django application away from old-school servers and onto the AWS Lambda serverless platform. It's almost like having your own private Infrastructure team!
No need to watch for OS security patches or tweak Apache settings -- just focus on delivering value to your users. All this with minimal changes to your Django application. Leverage the power of AWS to rapidly respond to spikes in user traffic, while saving money by only paying for the web requests actually needed.
For folks ready for serverless Django, this course covers:
- Which Django apps are best to migrate and how to prepare them
- Configuring a generic and portable development environment easily set up by new developers in minutes
- Deploying and updating your code to AWS Lambda
- Best practices in serving Django static files
- Leveraging AWS services to secure your site with HTTPS and your own custom domain name
- Learning how to configure a secure network environment in AWS VPC
- Connecting your Django application to a hosted RDS database
All this while leveraging the AWS Free Tier. While there are some lessons that may have additional cost to complete (e.g. bring your own domain name), the vast majority of this course will be using the AWS Free Tier and won't cost anything.
It's taught by Edgar Román. I was introduced to Django in 2009 and I consider it my go-to web framework. With continuous support from a vibrant community in addition to an incredibly rich ecosystem, I would be hard pressed to find another framework that matches up.
I've been using Zappa to host my Django applications for several years now, and I have found no other solution that is as powerful and cost-effective as serverless Django hosting on AWS -- especially for the solo developer working to get a product to market.
I hope you enjoy this course and harness the power of serverless Django with Zappa in your projects!
Setting up AWS
We establish the necessary AWS credentials
Setting up your local system
Let's create a reliable development environment
Creating a Django app
A simple Django project to get started
Activating the Environment
How to get your local system ready
Dive into Zappa
Hosting static files
What are static files?
Serving static files is different in Serverless
Static file options
A brief overview of two solutions
Using WhiteNoise for static files
Serve static files directly from your project
Using S3 for static files
Serve static files from an S3 bucket
Final thoughts on static files
Custom Domain Names
Connecting a Database
Overview of database connectivity
Your first RDS database
We walk through the AWS Console
Testing the connection
Let's try to connect to the database
Adding models to Django
Let's enhance our project a bit
Final thoughts on databases
Frequently Asked Questions
Who is this course for?
This course is for folks who are already familiar with Python and Django, but want to learn more about migrating to the AWS Lambda serverless platform
Is serverless the right step for my Django application?
Maybe. Most, but not all, Django applications are well suited to be serverless. Especially web sites that get moderate traffic (or less) and have usage that fluctuates over time
What do I need to complete the course?
You will need an Amazon Web Services account (or sign up for one) and optionally access to a custom domain name for your site. During the course, any overhead costs will be identified along with options for workarounds.
What if I need help?
You can ask us questions anytime through the community Discord channel or by sending us a message.
28 lessons (2h 24m)
1 complete project
1,177 lines of code