jolo-dev / zappa-template

A template for Zappa powered by Cookiecutter
1 stars 0 forks source link

Zappa Template

This repository should ease up your project setup by using Cookiecutter for choosing Flask or Django and Zappa for deploying your AWS Lambda.

Pre-Requisite

Make sure you have following locally installed.

# Best to install it globally
python3 -m pip install cookiecutter

cookiecutter gh:jolo-dev/zappa-template

Choose your Engine

Development

Wanna improve this?

cd *project_slug*
python3 -m venv .env
source .env/bin/activate
pip install --upgrade pip # In case you need to
pip install -r requirements.txt

Deployment

After setting up, you should be able to run following commands.

zappa deploy dev
# For Changes and Updating
zappa update dev
# Tear down the deployment
zappa undeploy dev

Working with Django

Django is a fully fleshed application which requires a database. In this template, the default database is deactivated. Here is a very good instruction, how to setup a database on AWS and Zappa

zappa deploy dev # The function needs to be up and running
zappa update dev # If neccessary
zappa manage dev "collectstatic --noinput"

Caution When Using Django

In the project_slug/settings.py, the ALLOWED_HOSTS is set to "*". This should be used with caution. You might replace it with the API endpoint you get from AWS. For Production, you should definitely change that. You are now able to reach the admin- section by appending /admin to the given URL.