Skip to main content

Serverless Django With AWS Lambda + API Gateway

Project description

Logo placeholder # django-zappa Build Status #### Serverless Django with AWS Lambda + API Gateway

django-zappa makes it super easy to deploy Django applications on AWS Lambda + API Gateway. Think of it as “serverless” web hosting for your Django apps. See in action here!

That means:

  • No more tedious web server configuration!

  • No more paying for 24/7 server uptime!

  • No more worrying about load balancing / scalability!

  • No more worrying about keeping servers online!

  • No more worrying about security vulernabilities and patches!

django-zappa handles:

  • Packaging projects into Lambda-ready zip files and uploading them to S3

  • Correctly setting up IAM roles and permissions

  • Automatically configuring API Gateway routes, methods and integration responses

  • Deploying the API to various stages of readiness


This project is for Django-specific integration. If you are intersted in how this works under the hood, you should look at the `Zappa core library <>`__, which can be used by any WSGI-compatible web framework.


$ pip install django-zappa


There are a few settings that you must define before you deploy your application. First, you must have your AWS credentials stored in ~/.aws/credentials’.

Finally, define a ZAPPA_SETTINGS setting in your local settings file which maps your named deployment environments to deployed settings and an S3 bucket (which must already be created). These can be named anything you like, but you may wish to have seperate dev, staging and production environments in order to separate your data.

    'production': {
       's3_bucket': 'production-bucket',
       'settings_file': '~/Projects/MyApp/settings/',
    'staging': {
       's3_bucket': 'staging-bucket',
       'settings_file': '~/Projects/MyApp/settings/',

Notice that each environment defines a path to a settings file. This file will be used as your server-side settings file. Specifically, you will want to define a new SECRET_KEY, as well as your deployment DATABASES information.

Basic Usage

Initial Deployments

Once your settings are configured, you can package and deploy your Django application to an environment called ‘production’ with a single command:

$ python deploy production
Your application is now live at:


If your application has already been deployed and you only need to upload new Python code, but not touch the underlying routes, you can simply:

$ python update production
Your application is now live at:


If you want to invoke Django management commands on the remote Zappa instance, you simply call the ‘invoke’ management command locally:

$ python invoke production check
System check identified no issues (0 silenced).


This project is very young, so there is still plenty to be done. Contributions are more than welcome! Please file tickets before submitting patches, and submit your patches to the ‘dev’ branch.

Things that need work right now:

  • ORM/DB support

  • Testing

  • Route53 Integration

  • SSL Integration

  • Package size/speed optimization

  • Fix the “hot-start” problem

  • Feedback

  • A nifty logo

  • Real documentation / website!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-zappa-0.3.0.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

django_zappa-0.3.0-py2-none-any.whl (12.5 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page