One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
This is instructions based on OS: Ubuntu v18.04
- Docker version >= 19.03.5
.
sudo apt-get install docker
- Docker-compose version >= 1.25.4
.
sudo apt-get install docker-compose
Prepare variable environment
- Rename the file .env.sample to .env
- Update value of variable in file .env
Run docker-compose
docker-compose up --build -d
- HealthCheck Acccess to: http://localhost:8000/api/v1/healthCheck will be received response as
{
"description": "the service is healthy"
}
- Test Celery: Acccess to: http://localhost:8000/api/v1/testCelery will be received response as
{
"task_id": "f14e3eb8-b496-4705-b417-5620308d4ab7",
"status": "ok"
}
- Test S3 Config: Acccess to: http://localhost:8000/api/v1/testS3Config will be received response as
{
"status": "Ok",
"buckets": [
"bucket-name-1",
"bucket-name-2"
]
}
Run Unit test & Performance test
1. docker exec -it <folder-name>_app_1 bash # Attach Shell to container web
2. pipenv shell # Active environment
3. python manage.py test # Run test case
Run Coverage Test
1. docker exec -it <folder-name>_app_1 bash # Attach Shell to container web
2. pipenv shell # Active environment
3. coverage run manage.py test # Run test case by coverage
(Optional: View By HTML) coverage html
(Optional: View Report) coverage report
Updating ...
- Install
black
andisort
pipenv shell
pip3 install black
pip3 install isort
pip3 install flake8
- (Optional) IDE Visual Studio Code (N.01) 1.1 Create folder .vscode and create file .settings.json in that. > .vscode/.settings.json 1.2 Add the script below and save
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": ["--ignore=E501,W503"],
"python.formatting.provider": "black",
"python.sortImports.args": ["--profile", "black"],
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"python.formatting.blackArgs": [
"--skip-string-normalization",
"--skip-magic-trailing-comma"
]
}
1. rm -rf Pipfile.lock # Remove Pipfile.lock
2 (Option with docker) docker exec -it sap_app_1 bash # Attach Shell to container web
3. pipenv shell # Active environment
4. pipenv install <package-name> # Install new package
5. pipenv install # Generate new Pipfile.lock
(*) Run command bellow
1. pipenv shell
2. isort . # format sort import library
3. black . # format code
4. flake8 --ignore=E501,F401,W503 . # Check issue and fix if have.
(If use IDE Visual Studio Code and configured (N.01) can skip step 2 and step 3)
0.1.0
- Thanh Nguyen Ly - Initial work - thanhngly - [email protected]