/zappa-drf-mysql

Serverless restful api to make it easy to use (Zappa + Django Rest Framework + MySQL)

Primary LanguagePython

DJANGO REST FRAMEWORK + ZAPPA + MYSQL

Serverless Restful Architecture with Zappa

Documentation (Korean)

https://wkdtjsgur100.github.io/zappa-mysql-django/

Features

  • Integrated services for python serverless restful api
    • Swagger(for API Docs)
    • zappa(for python Serverless)
    • django rest framework(for restful api)
    • Mysql(for relational database)
  • Divided settings(base, local, production)

Getting Started

  1. Input credential information into ~/.aws/credentials file from AWS IAM (or if aws cli is installed, run aws configure)
    [zappa]
    aws_access_key_id = <AWS access key id>
    aws_secret_access_key = <AWS secret access key>
    
  2. Make database and get endpoint(local, production)
  3. Make S3 bucket for static files and allow public access (or use cloud front for cdn)
git clone https://github.com/wkdtjsgur100/zappa-drf-mysql.git
# activate virtualenv based on python 3.8.6 if you want
pip install -r requirements.txt
zappa init
python ./setup.py
zappa deploy <my-zappa-stage>
zappa manage <my-zappa-stage> "collectstatic --noinput"

Undeploy

zappa undeploy <my-zappa-stage>

Deploy updated code

zappa update <my-zappa-stage>

Database Migrate

zappa manage dev migrate

Create superuser for admin

zappa manage <my-zappa-stage> create_admin_user <nickname> <email> <password>

Swagger

License

MIT License