9 December 2019 by Peter
post main image
Again another unexpected Docker issue. In a previous post I described why and how you must force Docker to use a subnet, to prevent sudden unexpected changes in the network with consequences like mail no longer working. This post is about Docker not respecting firewall settings, at least when running Debian / Ubuntu and ufw (Uncomplicated Firewall). Docker does not tell you this, and exposes ports, ...
Read more
27 November 2019 Updated 27 November 2019 by Peter
post main image
I have an ISPConfig server with Docker applications. They use the host Postfix mail transfer agent (MTA) to deliver mail to the outside world. Before using the send mail function I have a check if Postfix can be accessed. This works fine. But suddenly mail was not sent. The log file contained error messages like: 2019-11-26 17:31:56,758 ERROR MailMessage - send_mail: self.error_message = sending message, ...
Read more
24 November 2019 Updated 24 November 2019 by Peter
post main image
For this website I am using Flask and SQLAlchemy without the Flask-SQLAlchemy extension. I need pagination for several pages. For example the home page holds the list of blogs and it should show a maximum of 12 items per page. It is not that difficult to implement. The home page view function requires a page_number that defaults to 1 if it not specified: @pages_blueprint.route('/', defaults={'page_number': ...
Read more
18 November 2019 Updated 19 November 2019 by Peter
post main image
Probably many of you know only two mobile phone operating systems, iOS on Apple phones, and Googles Android on all other phones (some 80%). But there is also Ubuntu Touch (UT) originally developed by Canonical Ltd. and continued by UBports. I write a post about this because I am using UT on a Nexus 5 and wondered how difficult it would be to develop apps for it. When I discovered that you can use Python ...
Read more
13 November 2019 by Peter
post main image
While writing an application on my Docker platform I hit an unexpected problem, yes, another one ... This was the first time that I had to show the time on a page of a website running on Docker and it appeared that the time was UTC instead of local time. In the code I was just using the normal Python calls to get the time: import datetime ... now = datetime.datetime.now() hour = now.hour ...
Read more
13 November 2019 Updated 15 November 2019 by Peter
post main image
How to implement Flask multilanguage is explained in the Flask docs, see links below. But this is just a starting point. You need deeper understanding of the process to handle special cases like falling back to a default language, language switching, and the 404 Page Not Found exception. Assumptions In the remainder of this post we are using a language code, 'lang_code', that is available in the ...
Read more
18 October 2019 Updated 18 October 2019 by Peter
post main image
I run a server with ISPConfig with some 50 sites. The sites are static or PHP. I am developing Python Flask applications now and also want to run them on the ISPConfig server. You can create virtual environments on the ISPConfig server and run your application from here. But some time ago I have chosen to use Docker for development, staging and production. It takes time to set this up ...
Read more
9 October 2019 Updated 16 October 2019 by Peter
post main image
The Flask application I am writing to run this website has all code in a single 'app'. I already did some reorganizing as I wanted full separation of frontend code and the administration code. Now it it is time for total separation, meaning making the frontend a Flask app and the admin another Flask app while both running in the same domain and both reside in the same project directory. Because we ...
Read more
28 September 2019 Updated 11 October 2019 by Peter
post main image
Update 11 October 2019: I changed the addon-tag from '{% addon: ... %}' to '[[ addon: ... ]]'. The reason is that I wanted to be able to render the page text coming from the database, using render_template_string, and '{% ... %}' conflicts with Jinja2 tags. And yes, I do not want to implement a Jinja2 custom tag.  What is difficult about implementing a contact page with a contact form with Flask ...
Read more
15 September 2019 Updated 15 September 2019 by Peter
post main image
Before you read on, you may want to read my previous posts about multilanguage and language fallback, see links below. When I gave myself the assignment to develop and implement a multilanguage Flask website with SQLAlchemy I knew things could get difficult. I did not really took the time to design everything beforehand, I just read a lot about multilanguage on the internet and trusted my experience ...
Read more