Skip to content

H4mid2019/django_flask_kafka

Repository files navigation

Django_Flask_Kafka

Tech Stack

Django, Flask, Docker, PostgreSQL, Kafka

The Concept

It demonstrates two separate conternized apps by docker. One of them is Django, and the other one is Flask, which they can communicate by a message broker (Kafka). For instance, here, the concept is that Django is the backend which the user creates, updates, or deletes posts via its endpoint API, then the Flask app calculates and finds out the related posts, and it saves them in its database separately. To retrieve the posts with their related posts, you have to call the Flask endpoint API.

Prerequisites

  • These TCP ports must be free in the Host machine. 2181, 9092, 5434, 5433, 8000, 5000

  • Docker and docker-compose must be installed.

Setup

First, convert .env.example to .env then, In the main folder for the first time, run docker-compose up --build. After that, you can run it only by docker-compose up.

Endpoints:

  • 127.0.0.1:8000/api/posts :

with GET method: retrieves all posts

with POST method: makes a new post, the requests must be included a JSON formatted body with title, slug, body, image

  • 127.0.0.1:8000/api/post/{slug} :

with GET method: retrieves the single post with the {slug}

with DELETE method: deletes the post

with PUT method: it updates the post

  • 127.0.0.1:5000/posts :

GET method: It returns all posts with the related attribute for every post

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published