In this article, we’re going to cover quite an advanced topic in Django ORM. And after reading the article, you’re going to understand how Django ORM works a little bit better, especially how it handles joins. Here’s the video if you prefer watching over reading: Let’s say we have a Django project with these two simple models: Now, let’s play a little bit with Django…
What is WSGI and Why Do You Need Gunicorn and Nginx in Django
In this article, we’re going to talk about WSGI, Gunicorn, and Nginx. We will discuss why you need these things, and how they work together with Django. Here’s the video if you prefer watching over reading: The article will help you understand the process of deploying Django application better and I hope that at the end of it, you will understand what the heck is…
Introduction to SQLAlchemy ORM for Django Developers
I always used Django at work and for my personal projects. But on the recent project at work I had an opportunity to use Flask with SQLAlchemy. So I had to learn something new. Flask is easy peasy because it’s a microframework and it doesn’t have a lot inside. However, understanding SQLAlchemy and how to work with it was more difficult than I expected. In…
Django + Elasticsearch. Searching for awesome TED Talks
In the article we’re going to cover the basics of Elasticsearch: what it is, how to run it, how to communicate with it. Then, after we feel comfortable with Elasticsearch, we will start developing a simple web application with Django that will use the power of Elasticsearch. Running Elasticsearch Before diving into the concepts of Elasticsearch we should run it first. When you start reading…
Tale about Redis and sessions in Django
In this article we will learn the basics of Redis: what it is, how it stores data and what data structures it provides. Then we will take a look at session framework in Django. First we will learn how it works and then we will implement our own session engine that stores session data in Redis. It will be a great example for learning how…
Distributed systems with RabbitMQ
In this article, we’re going to talk about the benefits of distributed systems and how to move to distributed systems using RabbitMQ. Then we will learn the fundamentals of RabbitMQ and how to interact with it using Python. Distributed systems In this section, we’re going to learn the importance of distributed systems. If you’re interested in learning this by watching a video, then here it…
Django + GraphQL. Solving N+1 Problem using DataLoaders
In this article we’re going to focus on specific problem which you will probably face if you start developing GraphQL APIs. I will try to explain the problem first and then show you how it can be solved using DataLoaders. N+1 Problem Imagine that you’re developing a blog. Your server should provide GraphQL API so that your client app written in React, Vue or Angular…
Let’s talk about data structures in Python
Data structures is a way to store and organize data. Obviously, some data structures are good in one set of problems, but terrible in other ones. The right choice of data structure can make your code faster, more efficient with memory and even more readable for other human beings. In this article we are going to discuss the most important data structures in python. How…
Django + React + TS. How to create and consume GraphQL API
This article is dedicated to GraphQL. I will explain what GraphQL is and what advantages it has over REST. Then we will create a simple web application that exposes GraphQL API on server-side and consumes it on client-side. Stack on server-side: Python; Django; Graphene Django for creating GraphQL API. Stack on client-side: TypeScript; React; React Apollo for interacting with GraphQL API. Also I will show…
Как начать Django проект, который можно масштабировать
В статье создадим проект используя шаблонизатор cookiecutter-django, настроим статическую типизацию, добавим автоматическое форматирование кода с помощью black, создадим скрипт, который запускает тесты, проверяет правильность типов через линтер mypy и стиль кода через black. Напоследок добавим пре-коммит хук, который автоматически запускает скрипт с проверками перед каждым коммитом. Содержание Создаем проект с помощью cookiecutter-django Библиотеки Настройки Веб-сервер и Gunicorn Запускаем проект Настраиваем статическую типизацию Форматируем код с…