Jan. 8, 2018, 2:52 a.m.

Django

Django, URL, JavaScript

The less information a site has to transmit to each request, the better. Because we get less load on the server and on the communication channel. The first such improvement on the site I did was loading the list of articles when navigating the page paginator.

The point is that when the user wants to go to the next page with a list of articles and clicks on the link in the paginator , the click event is intercepted, the event is canceled, but the AJAX request is sent to the server with the number of the requested page. When the server receives such a request, it only renders the list of articles and sends it back.

Jan. 5, 2018, 2:11 a.m.

Django

Ubuntu, Django, VDS

With the growth of site functionality, as well as attendance, it was possible to successfully test the capabilities of the current VDS server, which I currently use. I would like to describe my experience with VDS, as well as show how much this VDS keeps under certain conditions and sizes of the project.

I decided to tell about it right now, because a week ago I expanded the server's capacity by purchasing additional memory.

All the further narrative will be subjective, but I hope that it will make it possible to make a general picture, so that newcomers will be able to navigate in what server they need for their needs, and this will facilitate the choice of the server.

Server Configuration

Initially, the site worked on the minimum configuration that I managed to take. The fare is $5 per month. By the way, my ISP also has a cheaper tariff (190 rubles / month), but it is fixed, whereas my current tariff allows me to configure the configuration necessary for me and increase the server's capacity to one that is not available at fixed tariffs.

Configuration:

  1. Processor cores: 2 x 2,7 GHz
  2. RAM: 512 Mb
  3. SSD: 5Gb
  4. OS: Ubuntu 16.04
  5. Access to the Internet: 100 Mbit/s

All configuration of the server was done exclusively through the console, without any auxiliary tools like ISP Manager, which also absorbs some of the RAM, so this modest RAM was enough for me for a long time

Dec. 30, 2017, 10:50 a.m.

Django

чат, message, Django, chat, сообщение

According to the tradition, I will tell you about my experiences on the introduction of new functionality on the site. At the moment, this functionality is a personal message between users. Of course, this now does not work as well as in well-known social networks ... but in the end everything will work. The main feedback on the forum, please.

So. I really wanted to add personal messages on the site, especially since I already mentioned this six months ago. The question remained, how to do it. When searching on the Internet it was possible to stumble upon an option when the following data model is being formed.

  • Id of the message
  • from_user - sender
  • to_user - recipient
  • pub_date - the date of the message
  • message - message content

Tried to implement this option, but I was stopped by the fact that suddenly after personal messages I want to make chats? So why not immediately lay the foundation for chats?

Dec. 4, 2017, 3:41 p.m.

Django

Releases, Django

Команда Django анонсировала выпуск Django 2.0

Этот выпуск начинается с использования в Django свободной формы семантического управления версиями, но нет существенных изменений в обратной совместимости (за исключением того, что был удалён Python 2.7), что было ожидаемым в выпуске 2.0. Обновление должно быть таким же, как и для предыдущих выпусков.

Примечания к выпуску

Совместимость с Python

Django 2.0 поддерживает следующие версии Python: 3.4, 3.5 и 3.6. Разработчики Django настоятельно рекомендуют именно эти версии и официально поддерживают только последнии версии данных версионных серий Python.

Django 1.11.x является последней версией, которая поддерживает Python 2.7

Django 2.0 станет последней версией с поддержкой Python 3.4. Если вы планируете развертывание Python 3.4 до конца срока службы для Django 2.0 (апрель 2019 года), то используйте Django 1.11 LTS (поддерживаемый до апреля 2020 года). Обратите внимание, однако, что конец поддержки Python 3.4 - конец марта 2019 года.

Поддержка третьесторонних библиотек для старых версий Django

После выпуска Django 2.0 Разработчики предлагают сторонним разработчикам приложений отказаться от поддержки всех версий Django до 1.11. В тоже время разработчики должны иметь возможность запускать тесты своего пакета с помощью python -Wd , чтобы отображались предупреждения об ошибках. После внесения исправлений для предупреждения об ошибке приложение должно быть совместимо с Django 2.0.

Nov. 27, 2017, 3:03 p.m.
Ambient

Django

Здравствуйте!

Изучаю, как написать сайт на Django. Пытаюсь настроить CKEditor, чтобы стиль оформления контента редактора был такой же, как и стиль оформления сайта. Заметил, что у вас пользователи могут писать свои статьи и там используется CKEditor.  А в нём такое же оформлен…
Nov. 10, 2017, 2:43 a.m.

Django

Django, ckeditor

In most of the site I use a self-written WYSIWYG editor, so it's not as advanced as I'd like. But for writing articles on the site, CKEditor is used, a very powerful and good editor. Nuance is that writing articles is available for all registered users of the site. But by default CKEditor allows you to upload images only to users with the status of staff.

For all other users, either an error page or the main page of the site will open instead of a file manager to search for images or the downloaded image.

A little polished the documentation, I managed to fix this problem. And to be honest, the solution looks rather strange, although it is proposed in the official documentation for the editor.

June 23, 2017, 4:12 a.m.

Django

Battery, tagging, Framework, Django, ckeditor, REST, django-bootstrap3

The convenience of developing on Django is not only that it is already a developed Framework with rich functionality, but also the availability of a large number of high-quality batteries (packages) that implement the necessary functionality that it would be quite difficult to write independently, especially if you are developing Site alone.

In the process of more than half a year's development of the site on the COM domain, it was just such a package that greatly facilitates life and accelerates the development:

  1. django-ckeditor
  2. django-autocomplete-light
  3. django-tagging
  4. django-bootstrap3
  5. django-modeltranslation
  6. django-daterange-filter
  7. django-phonenumber-field
  8. django-rest-framework
June 4, 2017, 4:52 a.m.

PostgreSQL

PostgreSQL, Django, LATIN1, UTF8

On the site there was one bug that manifested itself when trying to attach to files messages whose names were in Cyrillic. In this case, the site issued error 503. This occurred despite the fact that the database was encoded in UTF8, after correcting the encoding of the database itself in the previous article . While Django issued the following message:

'latin-1' codec can't encode characters in position 55-64: ordinal not in range(256)

The problem was that the server's coding was initially set to LATIN1. That is, the following commands gave the following conclusion:

postgres=# show server_encoding;
 server_encoding 
-----------------
 LATIN1
(1 row)

postgres=# show client_encoding;
 client_encoding 
-----------------
 LATIN1
(1 row)

postgres=# \encoding 
 LATIN1

Executing the command SET CLIENT_ENCODING TO 'utf 8'; did not work, after exiting psql, the encoding was returned to LATIN1 .

May 10, 2017, 12:38 p.m.

Django

AJAX, Django, Polling

Frequent surveys with AJAX allow you to establish a permanent connection between the browser and the server in order to update any data, for example, whether there are new notifications on the site for the user. For example, I organized a small system of notifications for registered users, which allows them to find out at the entrance to the site if there were answers in the articles and forum questions to which they are subscribed, and whether there were new articles and questions on the forum, to sections of which users were also signed.

The notifications are as follows:

April 30, 2017, 12:17 p.m.

Django

Like, Django, GenericRelation, Dislike, GenericForeignKey

In the article on creating a system of bookmarks on Django, an example was considered with the use of an abstract model for several types of bookmarks, namely for articles and comments on articles. Attention was also drawn to the fact that the model fields that had foreign keys to different models should have the same names to support the possibility of creating a single interface for adding bookmarks. This is made possible by the so-called "duck typing", which implies that objects that do not have a single inheritance hierarchy can be used in the same scenario if there are interfaces (methods) that have the same signature.

Literally the principle of duck typing sounds like this:

If it looks like a duck, swims like a duck and quacks like a duck, then it probably is a duck.

That is, having methods with the same signature, we can use objects that are not associated with an inheritance hierarchy, in the same context.

In the same article, let's consider the variant when using the Like Dislike system, not two different tables for articles and comments are used, and not even one that will contain a foreign key for an article or comment (that is, two columns, One of the columns, depending on what type of content the user activity is related to), and one table that will contain:

  • content_type - The content type to which the record belongs
  • object_id - Record ID
    • content_object - The generated foreign key to write, in fact the content object
  • Other additional fields
Looking for a Job?
14,000.00 руб. - 40,000.00 руб.
Разработчик Qt
Annino, Moscow Oblast, Russia
5,000.00 руб. - 15,000.00 руб.
Дизайнер
Moskovskiy, Moscow, Russia
25,000.00 руб. - 30,000.00 руб.
Разработчик Qt/C++
Barnaul, Altai Krai, Russia

For registered users on the site there is a minimum amount of advertising

A
Aug. 22, 2019, 11:24 p.m.
Aleksandr73

Qt - Test 001. Signals and slots

  • Result:47points,
  • Rating points-6
Aug. 21, 2019, 10:23 a.m.
Andrej Ermoshin

C++ - Test 002. Constants

  • Result:58points,
  • Rating points-2
Aug. 21, 2019, 10:15 a.m.
Andrej Ermoshin

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

  • Result:86points,
  • Rating points6
Last comments
Aug. 19, 2019, 7:41 a.m.
Andrej Jankovich

это проблема дистрибутива, попробуйте установить через пакетный менеджер snap Суть проблемы: libQt5Core которая лежит в дистрибутиве требует версию glibc >= 2.25 у вас видимо …
b
Aug. 18, 2019, 6:09 a.m.
bbb116

cqtdeployer /home/aleks/CQtDeployer/bin/cqtdeployer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /home/aleks/CQtDeployer/lib/libQt5Core.so.5) linux mint …
D
Aug. 17, 2019, 9:04 a.m.
Damir

github ChekableTView Правой групповая смена значения при перетаскивании левой как обычно.
Aug. 16, 2019, 1:03 p.m.
Evgenij Legotskoj

Потому, что в минуте 60 секунд
Aug. 16, 2019, 12:16 p.m.
Dmitrij

а почему делитель 60000, а не 1000?
Now discuss on the forum
Aug. 24, 2019, 7:21 a.m.
Evgenij Legotskoj

Не помню, давно уже с QML не работал, по-моему, обычно пишет в консоль, что не находит файл. В любом случае какую-то ошибку в консоль выкидывает. Но если честно, если у вас проект будет ак…
BG
Aug. 24, 2019, 4:27 a.m.
Brjus Gliff

Спасибо, вначале в документации было не понятно что к чему, теперь разобрался
I
Aug. 21, 2019, 8:36 a.m.
Intruder

Александр, мне не нужно перебирать. Вы говорите правильно, сначала я написал избыточный код просто не подумав. Задача такая, мне нужно просто переложить из QMap в атрибуты xml тега все, что там …
Aug. 21, 2019, 3:16 a.m.
nayk1982

Если Вы разрабатываете какую-то универсальную утилиту, которая вообще не привязана к логике, тогда как вариант: 1. Получить список таблиц через QSqlDatabase::tables 2. Для каждой табли…
EVILEG
About
Services
© EVILEG 2015-2019
Recommend hosting TIMEWEB