Book Image

Hands-On Microservices with Django

By : Tieme Woldman
Book Image

Hands-On Microservices with Django

By: Tieme Woldman

Overview of this book

Are you a Django developer looking to leverage microservices to create optimized and scalable web applications? If yes, then this book is for you. With microservices, you can split an application into self-contained services, each with a specific scope running asynchronously while collectively executing processes. Written by an experienced Python developer, Hands-On Microservices with Django teaches you how to develop and deploy microservices using Django and accompanying components such as Celery and Redis. You'll start by learning the principles of microservices and message/task queues and how to design them effectively. Next, you’ll focus on building your first microservices with Django RESTful APIs (DFR) and RabbitMQ, mastering the fundamentals along the way. As you progress, you’ll get to grips with dockerizing your microservices. Later, you’ll discover how to optimize and secure them for production environments. By the end of this book, you’ll have the skills you need to design and develop production-ready Django microservices applications with DFR, Celery/RabbitMQ, Redis, and Django's cache framework.
Table of Contents (18 chapters)
Free Chapter
1
Part 1:Introducing Microservices and Getting Started
5
Part 2:Building the Microservices Foundation
11
Part 3:Taking Microservices to the Production Level

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “This request applies the GET request to access the api.trip.com endpoint and addresses the hostels resource.”

A block of code is set as follows:

class AddressViewSet(viewsets.ModelViewSet):
    queryset = Address.objects.all()
    serializer_class = AddressSerializer

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

1 from rest_framework import generics
2 from .models import Address
3 from .serializers import AddressSerializer
4
5 class AddressList(generics.ListCreateAPIView):
6    queryset = Address.objects.all()
7    serializer_class = AddressSerializer
8
9 class AddressDetail(generics.
                       RetrieveUpdateDestroyAPIView):
10    queryset = Address.objects.all()
11    serializer_class = AddressSerializer

Any command-line input or output is written as follows:

$ curl -d '{"hostel_id":24, "start":"2024/03/01", "end":"2024/03/06"}' -H "Content-Type: application/json" -X POST http://api.trip/v1/hostels/

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “In the Name and Address fields, enter the values of your choice.”

Tips or important notes

Appear like this.