Advanced search
Evgenij LegotskojApril 18, 2022, 5:39 p.m.

DjangoDjango - Tutorial 058. Database Growth Due to django_session Table

Django, Postgres, garbage collection, Python, PostgreSQL

Lately, I have noticed that the fatal moment is approaching, when the disk space for the site on the hosting will catastrophically cease to be enough. And the database dump becomes incredibly huge, although there are no obvious prerequisites for this. The content size of the site isn't growing that fast, and the number of registered users isn't growing that fast either.

After examining the database, it was found that the size of the django_session table is just a gigantic almost 7 GB, and the size of the index also reaches almost 6.5 GB, despite the fact that the size of the database itself is 14 GB.

At the same time, the size of the second largest table is only 11 MB and this is a third-party application with a list of cities. And the size of the third table, which contains messages on the forum, is only 8 MB.

Accordingly, it was decided to figure out why this is happening and how to fix it.

Right now, I probably won’t reveal anything new to those who actively administer PostgreSQL databases, but for beginners and those who mainly deal with Django as a PET project, without professional use, the information may be useful.

Evgenij LegotskojFeb. 9, 2022, 6:11 a.m.

DjangoDjango - Tutorial 056. How to convert image to WEBP format when saving to ImageField

ImageField, Django, WEBPField, webp, Python

WEBP is an image compression format that was introduced by Google in 2010. Its main advantage is its low size without visible loss of quality compared to formats such as JPEG or PNG. Therefore, it is quite logical to use this format for storing images on the site, especially if you do not need to store the original images on the site.

After a long search, I still did not find a ready-made and simple solution that would support converting images to WEBP format on the fly.
Therefore, I decided to write my own version, which eventually consists of a couple of dozen lines and is as simple as a wooden board.

Evgenij LegotskojFeb. 8, 2022, 6:55 a.m.

DjangoDjango - Tutorial 055. How to write auto populate field functionality

field, Django, python, auto, Python

For a long time I wanted to write an article on how to write auto populate field functionality for a Django project. This is a very useful feature that allows you to change the content of other model fields in Django by setting a value to a field that uses auto populate.

First, why is it needed? - Such functionality allows you to reduce the size of the code in those places where you need to rewrite other fields of the object when they change. That is, for example, you do not have to redefine the save method each time in order to rewrite some field in case other fields of the object change. Also, using auto populate is basically a more advanced and neat way to manage data models in Django.
And also a similar approach can solve some problems and improve the site.

M
MarkGlenJuly 1, 2020, 3:43 p.m.

QtQt C++ и Python

nltk, Qt, Python, C++

Может быть Qt тут и ни при чём, тогда как это сделать в C++.
C++ учу. Python - ну слышал что такое есть, умею писать print("hello world").
Имеется огромное желание решить одну задачу.
Допустим, имеем библиотеку nltk в python и некую программу на C++.

nltk выдаёт такое:

---June 16, 2020, 6:42 a.m.

Python 3Python 10 line toast notifications

Python

Introduction

We often use print to monitor the state of a script, or when we're debugging. Instead of constantly looking at the terminal window and waiting for some kind of output, we can use toast notifications as a way to view the output while doing something else.

This is not at all difficult to do - we will use the built-in commands of our operating system to display notifications, simply by running them through Python. A few lines of code, and no third-party modules.

---June 16, 2020, 6:42 a.m.

Python 3Python 10 line toast notifications

Python

Introduction

We often use print to monitor the state of a script, or when we're debugging. Instead of constantly looking at the terminal window and waiting for some kind of output, we can use toast notifications as a way to view the output while doing something else.

This is not at all difficult to do - we will use the built-in commands of our operating system to display notifications, simply by running them through Python. A few lines of code, and no third-party modules.

mafulechkaJune 8, 2020, 3:58 a.m.

QtQt for Python 5.15.0 has been released!

Qt, Python, PySide

Qt is happy to announce Qt for Python 5.15.0! 🎊🐍

You can get the latest version with: pip install pyside2 or simply upgrade your current installation: pip install -U pyside2.

At the same time, the Qt developers wanted to release another version for users who are still using 5.14, so they decided to release 5.14.2.2. You can also get it via pip install pyside2==5.14.2.2.

Evgenij LegotskojApril 26, 2020, 3:08 p.m.

DjangoDjango - Tutorial 052. Redefining a User Model

Model, QuerySet, Python, django

There are various options for working with a user model for creating a user profile and adding some specific information, for example, a profile photo. One way is to add a profile model with the OneToOneField field for the user. This option is simpler than a proxy model or overriding a user model. But for me personally, redefinition of the user model turned out to be more effective in terms of organizing code and writing various methods that allow you to extract the necessary information from the user object in templates without resorting to writing template tags.

Therefore, let's consider exactly the option of redefining the user model in a project in Django

R
RED_SpiderNov. 23, 2019, 8:56 a.m.

Qtаномалия корвентации QString в char* Linux

Qt, Python, Linux

всем привет, есть библиотека которая является прослойкой между Qt библиотекой и питоном, она получает JSON и через калбек отправляет в питон

проблема в том что в некоторых случаях программа на Python падает, падает она через непонятную для меня аномалию, возможно кто-то может объяснить п…

Evgenij LegotskojOct. 27, 2019, 4:55 a.m.

EVILEGRelease EVILEG-CORE 0.0.5

Django, Releases, Python, EVILEG, ECNF-C

Introducing the new release of EVILEG-CORE 0.0.5.

Card image cap
Pulsum Via

Project for travelers from EVILEG.

Go
Fornex

Let me recommend you a great European Fornex hosting.

Fornex has proven itself to be a stable host over the years.

For Django projects I recommend VPS hosting

Following the link you will receive a 5% discount on shared hosting services, dedicated servers, VPS and VPN

View Hosting
Share on social networks
Donate

The EVILEG project has switched to a non-commercial basis and will develop solely on the enthusiasm of the site creator, the enthusiasm of users, donations and the hosting referral system

Thank you for your support

Available ways to support the project

PayPal

PatreonYandex.MoneyMore

C++ - Test 001. The first program and data types

  • Result:80points,
  • Rating points4

C++ - Test 001. The first program and data types

  • Result:66points,
  • Rating points-1
GR

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:90points,
  • Rating points8
Last comments

Qt/C++ - Lesson 061. Adding images to the application using the Drag And Drop method from the file manager

Доброго времени суток. А если нужно и изображение и текст? Что-то потерялся немного.... // Вместо отрисовки иконки и текста будем отрисовывать только одно изображение // с н…
AS

Qt/C++ - Lesson 004. QSqlTableModel – How to present the table from database?

error insert into TableExample " Количество параметров не совпадает" Я путь свой прописывала и даже бд удаляла, чтобы заново сделать, не работает. (всё остальное как у вас... Вроде ка…
i

Qt/C++ - Lesson 042. PopUp notification in the Gnome style using Qt

cialis powder comprare cialis online
LD

GameDev on Qt - Tutorial 1. Track mouse movement in QGraphicsScene

Вполне возможно, что ты не закинул graphicsView в дизайнере в виджет
LD

GameDev on Qt - Tutorial 1. Track mouse movement in QGraphicsScene

Кому интересно, поворот в slotTarget можно в одну строку организовать this->setRotation(90 + rotation() + qRadiansToDegrees(qAtan2(mapFromScene(point).y(), mapFromScene(point).x())));
Now discuss on the forum
M

Sorting the added QML elements in the ListModel

legal online pharmacy
  • Nomad
  • July 30, 2022, 5:42 a.m.

Как работать с HTMX?

Приветствую колеги. На днях наткнулся на вот это : https://htmx.org/ На офф сайте написанно вот такая фраза: htmx gives you access to AJAX, CSS Transitions, We…
h
  • harisr
  • July 25, 2022, 2:56 a.m.

QT - Native App Integration

Привет, у нас уже есть собственное приложение для Android. Можем ли мы интегрировать пользовательское представление QT в приложение со всем приложением QT внутри представления. Если да, ука…

Правильный запуск сервера на vps - Django

О я как то себе дома локальный сервер создавал. Вам же нужно просто сделать ручками конфигурацию системы. Настроить Nginx ну либо Apache (тут кому что нравится). Соответственно БД и всё остально…
o

Распознание объектов

Я к тому, что, возможно, софт уже есть.
About
Services
© EVILEG 2015-2022
Recommend hosting TIMEWEB