Skip to content

vantares/deploy-django-app-with-k8s

Repository files navigation

Demo Devops Python

This is a simple application to be used in the technical test of DevOps.

Getting Started

Prerequisites

  • Python 3.11.3

Installation

Clone this repo.

git clone https://bitbucket.org/devsu/demo-devops-python.git

Install dependencies.

pip install -r requirements.txt

Migrate database

py manage.py makemigrations
py manage.py migrate

Database

The database is generated as a file in the main path when the project is first run, and its name is db.sqlite3.

Consider giving access permissions to the file for proper functioning.

Usage

To run tests you can use this command.

py manage.py test

To run locally the project you can use this command.

py manage.py runserver

Open http://localhost:8000/api/ with your browser to see the result.

Features

These services can perform,

Create User

To create a user, the endpoint /api/users/ must be consumed with the following parameters:

  Method: POST
{
    "dni": "dni",
    "name": "name"
}

If the response is successful, the service will return an HTTP Status 200 and a message with the following structure:

{
    "id": 1,
    "dni": "dni",
    "name": "name"
}

If the response is unsuccessful, we will receive status 400 and the following message:

{
    "detail": "error"
}

Get Users

To get all users, the endpoint /api/users must be consumed with the following parameters:

  Method: GET

If the response is successful, the service will return an HTTP Status 200 and a message with the following structure:

[
    {
        "id": 1,
        "dni": "dni",
        "name": "name"
    }
]

Get User

To get an user, the endpoint /api/users/ must be consumed with the following parameters:

  Method: GET

If the response is successful, the service will return an HTTP Status 200 and a message with the following structure:

{
    "id": 1,
    "dni": "dni",
    "name": "name"
}

If the user id does not exist, we will receive status 404 and the following message:

{
    "detail": "Not found."
}

License

Copyright © 2023 Devsu. All rights reserved.

Developer Documentation

Docker image create using DockerFile the image is public accesible on DockerHub

https://hub.docker.com/repository/docker/vantares/docker-django-app/general

On GitHub Packages in: https://github.com/users/vantares/packages/container/package/docker-django-app

Workflows created:

  • Build and push
  • Release
  • Lint code check with flake8
  • Synk security scan

Application deployed to EKS

About

Dockerizing a Django Application. Deploying a Django Application With EKS

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •