python manage.py collectstatic
python manage.py runserver
zappa update dev
- Sync static assets to AWS S3:
Environment and Infrastructure Setup
aws s3 sync static/ s3://bodycalc.io/static/
Zappa AWS deployment manager setup
pip install awscli
django-admin startproject app # create a new project named app
python manage.py runserver # to verify that django installed and initialized correctly
python manage.py startapp bmi # create the BMI web app
pip install -r requirements.txt
python manage.py bower install
- Note that Zappa relies an IAM user which is specified in django.zappa_settings.json. I placed a copy of the IAM policy in json format in aws-iam-policy.json.
- When I had to manually add the VPC settings to zappa_settings.json. I never figured out the individual policy permissions for this and so ended up temporarily adding admin rights to the project's IAM user.
- Ensure that the RDS MySQL database uses IAM access rather than traditional username / pwd.
- Manual deployment steps
- Enable CORS in AWS API Gateway. this is necessary for Fontawesome files.
- add VPC settings to zappa_settings.json
zappa init # see notes below on installation details
zappa deploy dev # Deploy app to AWS
zappa undeploy dev # Delete from AWS
zappa update dev # update existing app to AWS
zappa manage dev "collectstatic --noinput" # collect static assets
zappa tail # view Lambda execution log
- DATABASES: changed settings to AWS RDS MySQL. config settings are stored locally in mysite/.env
- ALLOWED_HOSTS: added FQDN's for amazon.com and lawrencemcdaniel.com per suggestions in the Django - Zappa Guide
- SECRET_KEY: moved to locally-stored .env file
- DEBUG: moved to locally-stored .env file