Roman's Blog

Random notes of a Python developer

Featured Image

Running Multiple Celery Beat Instances in One Python Project

 Feb. 1, 2021    0 comments 

In Python world Celery is a popular tool for running background tasks. It includes Celery beat that allows to run periodic tasks on some schedule. At my current work I participated in developing a system for running multiple periodic tasks. Since our technology stack is based on Python, Celery beat was a natural choice. One of the requirements to the system was granular control over individual tasks, that is, the ability to start/stop/restart each task individually. The straightforward solution was to run multiple Celery beat/worker pairs for each task, but after some googling it turned out that running multiple Celery beat instances seemed to be impossible. At least everybody said so, e.g. check this Stack Overflow discussion. If you try to do so you'll get duplicate tasks in your workers because each beat sends tasks to each worker. (...)

Read post

 CeleryPython

Featured Image

Interactive Dental Chart in HTML/JavaScript

 Jan. 17, 2021    0 comments 

One of my side-projects that I do on my free time is is a patient management system for my wife's dental clinic. It's written in Python/Django and it's a closed source project for now, but one thing I'd like to share is an interactive dental chart that allows to record the state of patient's teeth. Of course, the actual implementation is a bit more complex than this an it interacts with the Django back-end via Ajax requests but you can use this code as a basis for your own projects. Here's a link to JSFiddle: https://jsfiddle.net/romanvm/bpx8zc76/3/ with the code. Feel free to use this code as you see fit.

Read post

 CSSHTMLJavaScript

Featured Image

Formsets In Django Class-based Views

 Dec. 14, 2020    0 comments 

Django offers several out-of-the-box class-based views, including CreateView and UpdateView, that allow you to quckly implement basic CRUD functionality in your web-application without much of boilerplate code. Under the hood CreateView and UpdateView classes create, validate and save a Django ModelForm instance tied to your model class. But sometimes you need to create/edit related model instances along with the main model on the same page. (...)

Read post

 DjangoPython

Featured Image

Extracting Text from a PDF Using Python

 Jan. 6, 2019    0 comments 

Recently I needed to extract text from a PDF file using Python. Quick googling led me to PyPDF2 package, however I wasn't able to extract any text from my test PDF with it. The test PDF was created with Google Docs (a very common scenario) and did not have any fancy formatting, so PyPDF2 was disqualified for my purposes. After further googling I found pdfminer package and its Python 3 compatible version — pdfminer.six. (...)

Read post

 Python

Featured Image

September Conferences

 Oct. 18, 2018    0 comments 

This September I attended two international conferences dedicated to the developement of Open Source multimedia solutions: VideoLAN Dev Days and Kodi DevCon. (...)

Read post

 Events