YimengL / todobackend

REST API for Todo Items using Django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker in AWS Todobackend Sample Application

This repository provides a sample application based upon the Todo-backend project.

Install dependencies

$ pipenv shell
(todobackend) $ pipenv install -r src/requirements.txt

Run Unit Test

$ pipenv shell
(todobackend) $ pipenv install -r src/requirements_test.txt
(todobackend) $ cd src
(todobackend) $ python manage.py test --settings todobackend.settings_test

Build Docker Image

$ docker build -t todobackend-release .

Run the server with uwsgi server

$ docker run -it --rm -p 8000:8000 todobackend-release uwsgi \
--http=0.0.0.0:8000 --module=todobackend.wsgi --master

Docker Compose

Use docker-compose to build and run the test

$ docker-compose build test
$ docker-compose run test

Use docker-compose to run the release

$ docker-compose up release # build + run

Tear down the running docker image, and remove the volume

$ docker-compose down -v

MYSQL DB migration

$ docker-compose up migrate

Copy the static file

# do it before docker-compose up app
$ docker-compose run app python3 manage.py collectstatic --no-input

Integration Test

$ docker-compose up acceptance

使用Make来运行程序

$ make test # run unit test
$ make release # launch the app
$ make clean # stop the app, clean the image

About

REST API for Todo Items using Django


Languages

Language:Python 79.4%Language:Dockerfile 8.4%Language:Shell 6.8%Language:Makefile 5.4%