At the beginning of the 2015 I worked on a python application in Google App Engine. After all, because of some limitations and vendor locks, the app was moved to docker environment. Here is the list of these limitations. I did not check since then, maybe something changed, there is App Engine Flexible Environment, but it’s still in beta.
Celery background task with notifications through socket.io
If you have some long background tasks, sometimes it’s useful to notify a user about the progress. In this article i put an example for flask, celery and socket.io. In short form it’s described in flask-socketio documentation.
How to create a test certificate to sign Electron application
If you use electron-builder and you need to sign your app to test the update process, but you don’t have the Apple Developer account.
Flask-Admin formatters examples
To customize how the model’s columns are displayed in the list of objects in Flask-Admin, it requires column formatters. Here are some examples.
Macbook Air 2012 upgrade to Macbook Pro 2016
The last 4 years I worked on Macbook Air Mid 2012 - 8 Gb, now I have Macbook Pro 13.3" 2016 - lowest model, no touchbar, but with 16 Gb. Actually there is nothing to compare, the Macbook Pro is better in every aspect.
The main result is that everything 1.5-2 times faster, some examples:
Fast tests with in-memory MongoDB
It’s always better to have a faster tests. For tests which use a database there are two ways to increase the speed:
- a mock library, like mongomock
- in-memory database
Achievments in 2016
A list of my most important achievments in 2016:
- started a new job at MailInBlack & LetSignIt, like it.
- used a lot of different technologies: flask, celery, angular, mondodb, scala, docker, azure & google clouds, google app engine
Migrate from octopress to hugo
As usual at the beginning of the year I decided to continue the blog, but I was on a new macbook with a fresh system and also I forgot how to use octopress. So, why not to try something new.
NGINX for static files for dev python server
When you work on the backend part of django or flask project and there are many static files, sometimes the development server becomes slow. In this case it’s possible to use nginx as reverse proxy to serve static. I’m using nginx in docker and the configuration is quite simple.
strftime for datetime before 1900 year
Recently I’ve got an error for birthdays before 1900 year
ValueError: year=1890 is before 1900; the datetime strftime() methods require year >= 1900
for this code:
import datetime
datetime.date(1890,7,1).strftime('%d.%m.%Y')
And it’s described in the documentation
The full set of format codes supported varies across platforms, because Python calls the platform C library’s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation.
The exact range of years for which strftime() works also varies across platforms. Regardless of platform, years before 1900 cannot be used.
One of the ways to solve this:
birthday = datetime.date(1890,7,1)
'{0.day:02d}.{0.month:02d}.{0.year:4d}'.format(birthday)