Evgenij LegotskojApril 18, 2022, 4: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. 14, 2022, 3:24 a.m.

DjangoDjango Rest Framework - Tutorial 001. Adding Token Authentication

Django Rest Framework, QML, Authentication, Token, drf, Felgo

At the moment I am actively working on an application that will work with the REST API of a Django site. And one of the first steps was to set up user authentication by token, but in order for this to work, you must first obtain an authorization token.

Let's look at how this can be done.

Evgenij LegotskojFeb. 10, 2022, 3:13 a.m.

DjangoDjango - Lesson 057. Multilanguage support in MarkdownField with auto populate functionality

MarkdownField, markdown, modeltranslation, Django

The article How to write auto populate field functionality described the simplest functionality of the MarkdownField field to support markdown syntax on a site with automatic generation of html content.

I did not immediately show advanced functionality to make it easier to understand what a Markdown-like field is like. But now I would like to expand this functionality to add support for multilingualism.

Evgenij LegotskojFeb. 9, 2022, 5: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, 5: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.

Evgenij LegotskojFeb. 7, 2022, 7:52 a.m.

QtQt/C++ Tutorial 092. Creating translations for external text sources

Qt 6, Qt, Qt 5, QtLinguist, translation

Today we will discuss a rather interesting option for adding translation to a Qt/C++ application. Namely, adding translations for texts from external sources when you display texts from databases, an external API, or just some other files.

Such a situation can arise in the following case, for example, analysts in your project form sets of data and texts in some external database or text files, but there is no possibility of multilingualism for some reason. And therefore, you do not have the option to select the language as an additional parameter when requesting this data. Or, for example, the final data is downloaded from an external resource and stored in a SQLite database, of course, without additional translations. But at the same time, you are developing a multilingual application and you need to somehow generate translation files for these texts, so that the translation team can translate them, and you can connect them in the application.

But in Qt it is possible to solve this problem as well. In such situations, you can also generate source code files in the same way, for example, generate them when importing data during application development, and then generate translation files with the extension *.ts , which are used in QtLinguist to translate the application to Qt, and then generate binary *.qm translation files that will be included in the application.

Let's see how it works and what needs to be done for this.

Said PyDec. 26, 2021, 11:22 a.m.

Python 3Python: How to Test Internet Speed

speedtest

Probably, you have used the speedtest website before, but did you know that speedtest has a python library.
In this tutorial, We will learn to use the speedtest library to test your internet Speed. We'll also learn how to use speedtest command lines.

Let's get started.

Ruslan PolupanNov. 24, 2021, 2:39 a.m.

QtInstalling the QIBASE (Firebird) Qt 6.2.1 driver on openSUSE Tumbleweed

Qt 6, IBASE, FireBird, SQL

Another reinstallation. I decided to install Qt 6 already.

Andrei YankovichMay 24, 2021, 9:10 a.m.

QtRelease of the C++/Qt and QML application deployment utility CQtDeployer v1.5.0

deploy, cqtdeployer, QML, Qt, deb

Release of the C++/Qt and QML application deployment utility CQtDeployer v1.5.0

Logo

BlinCTMarch 7, 2021, 7:04 a.m.

QtHow to display debug Qt symbols if you are using CLion instead of QtCreator

I welcome everyone.
As everyone has known for a long time, Qt has already steadily switched to CMake, replacing QMake.
And this means that you and I can use other IDEs to work with this framework.
CLion works great with both CMake and the Qt framework itself. With the exception of working with QML, everything is excellent.
But what should we do if we need to debug the project, but instead of understandable symbols, we get pointers in memory and hard-to-read objects?

  1. We need to copy the directory with debug symbols from the Qt framework, for example, to our user.
  2. Write information in the .gdbinit file so that the debug understands where to go for the necessary information.

The link below has another option through prepared scripts.
Link to original article qt-debug

Evgenij LegotskojDec. 31, 2020, 6:05 a.m.

EVILEGHappy New Year to all EVILEG Community !!!

Дорогие пользователи EVILEG!

Поздравляю Вас с наступающим Новым Годом!!!
Желаю счастья, здоровья и успехов в программировании в новом 2021 году!!!

DmitrijDec. 31, 2020, 4:19 a.m.

C++Generating pseudo-random numbers in Qt (QRandomGenerator)

QRandomGenerator

This note is a small addition to the article Generating pseudo-random numbers using the random STD library . The author omitted one of the useful functions of the QRandomGenerator class in it. The generator implementation is as follows:

QRandomGenerator *rg = QRandomGenerator::global();
for(int i = 0; i < 10; i++) {
    qDebug() << rg->bounded(1, 10);
}

The global() function returns a pointer to a ready-to-run random number generator. An alternative to it is the system () function, which implements the possibilities for generating random numbers embedded in the operating system. The bounded(a, b) function returns a random number from a to b. The following functions are also available to us: generateDouble() - returns one random number from the range from 0 to 1, generate() and generate64() - return a random 32 and 64 bit random number, respectively. All of the listed functions will return a new sequence of numbers each time they are run/called.
In my opinion, such a toolkit is able to cover all the needs of an average programmer for generating random numbers without connecting third-party libraries.

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
AB

C++ - Test 006. Enumerations

  • Result:30points,
  • Rating points-10
MH

C++ - Тест 003. Условия и циклы

  • Result:42points,
  • Rating points-8
AB

C++ - Test 005. Structures and Classes

  • Result:50points,
  • Rating points-4
Popular publications in the last 90 Days
Last comments

EVILEG-CORE. Caching properties of model objects using model_cached_property

Здравствуйте. В общем меня интересует такой вопрос. Я пробовал это на Like , Dislike. Как я понимаю если не перевалидировать кеш то ничего не изменится на странице. Вернётся значение из кэша? От…
A

Qt/C++ - Lesson 006. QSqlQueryModel – Tables in Qt with SQL-query

Здравствуйте! Подскажите как сделать запрос к базе SQLite с двумя параметрами, в итоге нужно получить не список строк, а только факт наличия строк, соответсвующи именно двум условиям. В SQL…
A

Django - Tutorial 011. Adding comments to the site based on Django

https://mir74.ru/27323-12-krasavic-sdelali-podarok-stalnomu-gigantu.-rabotnicy-mmk-snyalis-dlya-yubileynogo-fotokalendarya.html
a

Django - Tutorial 011. Adding comments to the site based on Django

I read that Post and got it fine and informative.https://aflife.ru/

Django - Tutorial 023. Like Dislike system using GenericForeignKey

Хорошо. Большое спасибо. Посмотрю что из этого получится.
Now discuss on the forum
o

Запрос на изменение БД с помощью оператора UPDATE и странное поведение QTableView

или запрос к базе так https://www.w3schools.com/sql/sql_ref_order_by.asp или сортировка в модели через прокси модель https://doc.qt.io/qt-5/qsortfilterproxymodel.html
o

Как очичтисть очередь событий для конпки

нужно сделать связку qml и c++, тяжелые задачи отправляются на обработку в с++, в qml остаются только быстрые. и у кнопок есть свойство enabled: true\false при запуске\остановке з…
A

Развертывание QML приложения

Полностью согласен, что пример не удачный, но я так как раз попытался выразить то, что вы далее описали с примером со скадой, часть .dll и часть .qml с интерпритацией. И в Вашем ответе я ув…
AB

Sorting the added QML elements in the ListModel

I am writing an alarm clock in QML, I am required to sort the alarms in ascending order (depending on the date or time (if there are several alarms on the same day). I've done the sorting …
EK

HTTP server на Qt

Давно было, уже не помню как, но разрулил. Спасибо :)
About
Services
© EVILEG 2015-2022
Recommend hosting TIMEWEB