Update Environment Variables

Make sure you set the proper environment variables required for deployment in set_env_vars.py, and run it after deploying the application to set env vars for your application. After updating the env vars in set_env_vars.py Run the below command to set/update env variables for our application.

python set_env_vars.py

How to Deploy Django Application in AWS Lambda?

Pre-requisite: AWS, Python

Django is a Python web framework that makes it easy to build web applications quickly and securely. It has a large and helpful community that provides support and contributes to its development.

AWS Lambda is a serverless computing platform that runs your code in Docker containers, provides us with the best possible speed, and there is a number of third-party apps, and tools that make Lambda usage much easier, in this tutorial we gonna use one such tool.

Django Application Deployment using AWS Lambda

Similar Reads

Why We Choose AWS Lambda

There are several reasons why we choose AWS Lambda over other choices like AWS EC2, Elastic Bean Stalk, etc for deploying our Django application:...

Zappa

Zappa is a serverless framework for deploying python applications using AWS Lambda and API Gateway. Zappa helps us to manage our Django applications easily and provides a convenient way to keep your deployments up-to-date. Zappa has a large and active community that provides support and contributes to its development, making it a great choice for deploying your Django applications. Prerequisites:...

Setting up a Django Project

1. Create and activate a Virtual environment for this Django project (ignore if already have  one)...

Initialize Zappa

1. In your Django project’s root directory, run the following command:...

Configure Database

For local development, we can use SQLite, but in general, it’s better to use MySQL server for better performance in large-scale applications, here in this case we used AWS RDS as a DB server....

Setup Static Files Hosting

...

Deploy Application

Static files are essential files that don’t need any dynamic changes, like static HTML, CSS, js, fonts, etc....

Update Environment Variables

We are all set for deployment, we configured our app with the required things, and now we can deploy our application to AWS Lambda....

Post-Deployment Steps

Make sure you set the proper environment variables required for deployment in set_env_vars.py, and run it after deploying the application to set env vars for your application. After updating the env vars in set_env_vars.py Run the below command to set/update env variables for our application....