https://github.com/danielholmes/django-emulate-aws-env
Emulate AWS serverless environment (API Gateway + Lambda) in dev and test for Django project
https://github.com/danielholmes/django-emulate-aws-env
api-gateway aws django lambda zappa zappa-django
Last synced: 3 days ago
JSON representation
Emulate AWS serverless environment (API Gateway + Lambda) in dev and test for Django project
- Host: GitHub
- URL: https://github.com/danielholmes/django-emulate-aws-env
- Owner: danielholmes
- License: mit
- Archived: true
- Created: 2017-05-07T00:41:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-01T00:44:37.000Z (over 8 years ago)
- Last Synced: 2025-09-30T13:07:42.346Z (10 days ago)
- Topics: api-gateway, aws, django, lambda, zappa, zappa-django
- Language: Python
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README
=============================
Django Emulate AWS Env
=============================.. image:: https://badge.fury.io/py/django-emulate-aws-env.svg
:target: https://badge.fury.io/py/django-emulate-aws-env.. image:: https://travis-ci.org/danielholmes/django-emulate-aws-env.svg?branch=master
:target: https://travis-ci.org/danielholmes/django-emulate-aws-env.. image:: https://codecov.io/gh/danielholmes/django-emulate-aws-env/branch/master/graph/badge.svg
:target: https://codecov.io/gh/danielholmes/django-emulate-aws-envEmulates the conditions of an AWS "Serverless" environment (`API Gateway`_ + Lambda_) in your test and development
environments (such as those deployed by Zappa_).Quickstart
----------Install Django Emulate AWS Env::
pip install django-emulate-aws-env
Add the Django Emulate AWS Env middleware. This should be the highest possible priority in your list and just in your
development and test environments:.. code-block:: python
MIDDLEWARE = [
'emulate_aws_env.middleware.modify_request',
...
]Or if you're using a dedicated settings file for tests/development:
.. code-block:: python
from .base import *
...
MIDDLEWARE = ['emulate_aws_env.middleware.modify_request'] + MIDDLEWARE
Features
--------The `API Gateway`_ service has the following restrictions which aren't present in the default environment used to test
Django projects:- `It doesn't allow duplicate query string names`_
- `The request content length can't exceed 10485760 bytes`_The provided middleware modifies the request to these restrictions.
Running Tests
-------------Does the code actually work?
::
source /bin/activate
(myenv) $ pip install tox
(myenv) $ toxCredits
-------Tools used in rendering this package:
* Cookiecutter_
* `cookiecutter-djangopackage`_.. _`API Gateway`: https://aws.amazon.com/api-gateway/
.. _Lambda: https://aws.amazon.com/lambda/
.. _Zappa: https://github.com/Miserlou/django-zappa
.. _`It doesn't allow duplicate query string names`: https://forums.aws.amazon.com/message.jspa?messageID=676456
.. _`The request content length can't exceed 10485760 bytes`: http://stackoverflow.com/questions/33762259/increase-maximum-post-size-for-amazon-api-gateway
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage