This website is a multi-language CMS / Blog I build with Python, the framework Flask and SQLAlchemy. It is deployed on my ISPConfig3 (Nginx + Mariadb) server using Docker which is also used for development. The website features user registration, a lot of administrator functions, privacy and security, so this is not a small project. Some 'highlights':
- Python 3 (3.7)
- Docker, docker-compose
Steps are development, staging and production, all using docker and docker-compose. Development uses the Flask development server, staging and production use the Gunicorn server. Finally, ISPConfig3 is used to control the domain, database and SMTP email, Nignx is configured as a reverse proxy.
Do not expect to find here solutions like using CDNs, Google Analytics, Facebook plugins, etc. Privacy is one of the most important things in life. While impossible to prevent tracking us and collecting our valuable private data, I believe we all must make an effort to minimize this.
Security always is a work in progress. It starts with design for security which also means that you must put a lot of effort in logging things. There are great tools like OWASP ZAP and online services like securityheaders.com and detectify.com that can help you identify vulnerabilities.
While the text of this website is written in English, it supports multiple languages using the Flask-Babel extension. The other language texts are machine translated at the moment using the DeepL API and sometimes are far from perfect, but you can always edit the messages.po files.
Artificial intelligence (AI) is invading our lives in many ways. Python is the language used with machine learning and deep learning. Personally I do not like these developments because no one can be held liable for the decisions taken. But AI can also help us in good ways like recommending other news items at the end of a news item.
Was also looking for a Python GUI. Started using tkinter but soon found this had many limitations for my purpose. Bumped into Kivy and went building a first app with it. You can also deploy a Kivy app on Android, but do we want to support the Android ecosystem? Will also be posting about my Kivy project.
The next months I will try to document some of the things I did to make this work, like using SQLAlchemy without Flask-SQLAlchemy, avoiding poorly maintained Flask extensions, migrations using Alembic, minimizing the size of a Docker image, docker-compose configurations.
Thank you, Peter
Leave a comment
- Flask with multiple forms on a page posted using AJAX and returning a rendered form result
- SLQAlchemy dynamic query building and filtering including soft deletes
- Two Flask apps, frontend and admin, on one domain using DispatcherMiddleware
- Using UUIDs instead of Integer Autoincrement Primary Keys with SQLAlchemy and MariaDb
- SQLAlchemy server-side datetime calculations
- Eliminate repetition and improve maintenance by creating a Flask view class