Below you will find pages that utilize the taxonomy term “Python”
F# vs Python development - Giraffe vs Django
Recently I have been playing around with building a web site using F# through the Giraffe library. This has been an enlightening experience. Most of my previous web development knowledge is from the Python world, specifically Django. In this blog I will try to compare the feel these two so different niches have.
F# vs Python
First things first - F# is a statically compiled functional language, which targets .NET framework. I’m using .NET5 specifically, although, of course, earlier versions have F# support as well. The language has been around for quite some time and is popular in some narrow circles. I find it unfortunate - it is a great programming tool and it enjoys from the rich .NET echo system. A fair comparison would be that F# occupies the same position in the .NET/CLI world vs C# as Scala in JVM vs vanilla Java.
Using python to analyse effects of COVID-19 on mortality in the UK
COVID-19 has been with us for almost a year as a news item. The reports indicate, that a lot of people died of the disease. Every lost life is a tragedy, of course. It is important to understand, how exactly the pandemic affected mortality in large populations. Unfortunately, the cause of death attribution to COVID-19 is not always accurate. Sometimes people are recorded as have died of the virus simply because they tested positive, even when they had none of very few real symptoms. On the other hand, some deaths from the infection might very well gone unnoticed. So today I will use some python code and publicly available figures to try and draw some conclusions from the data that we do have and can be reasonably confident about.
Running multiple Django sites on the same server
What if you find yourself managing more than one Django-based web site at the same time in production? Do you have to deploy each one of them on a separate server? Or can you manage with just one, saving on hosting expenses? How will you go about the setup in this case, ensuring smooth running of these sites side by side.
For “real” production web site, with medium to heavy traffic, it is probably the best to have a separate server. Even more so, for busier sites you might very well have multiple servers in order to handle the workload. As they say, it is a good problem to have.
Bootstrap 5 module for Django
Bootstrap is an HTML/CSS styling framework, originally developed by Twitter, and currently published in open source. While not the only player in that field, it remains a very popular choice for many web developers. It helps people with limited artistic abilities, such as yours truly, to create web sites that are reasonably easy on the eye. It provides many styles and utilities to make the visual layout of a web page consistent and user friendly.
Moving from Drupal to Django Wagtail
Close to 15 years I have been using Drupal for my personal web sites. Drupal is a flexible and configurable CMS (Content Management System) web framework, similar to Wordpress. It has been a relatively dependable working horse for my hosting needs - simple and not too flexible, but relatively robust and reliable. It was quite straightforward to bring up a new web site via it:
- Create a new MySQL database
- Create a config directory for the site
- Update the settings file
- Go through the setup wizard
- Configure more stuff in the admin interface
- Voila!
Unfortunately, there are a number of drawbacks to Drupal. I was sort of ignoring those for years, mainly because it “just kinda worked” for most of what I wanted it to do. I didn’t require any advanced configuration that would necessitate code changes, and the rest was relatively simple via the admin interface. However, in the recent year or two I got frustrated with the shortcomings of the framework on one hand, and on the other I decided I did want some more advanced customisation and control over the web sites.
Lessons learned from web development with Django
Django is a web development framework for Python. I used it for a few web sites, including a relatively large one. I must say, my overall impression is rather ambivalent.
First of all, Django is definitely excels when you need stuff done, quickly. A lot of stuff simply works out of the box or with minimum effort, including DB access and ORM, caching, templating and so on. And there are so many extensions available! Probably only some PHP frameworks have more plugins and extensions, but who wants to write in PHP for a living?
My first open source python module - Drupal data download
2020 just arrived and it’s time for something new. I have been using Drupal since 2006, so we have been together for almost 14 years! It’s an impressive journey and I am look back with satisfaction - Drupal is simple to use if it fits the requirements exactly, and I stoically avoided touching any of its smelly PHP bowls. However, with the arrival of Drupal 8 I realised, that I couldn’t migrate to it even my simple and straightforward sites. Therefore, I decided to slowly migrate to Django + Wagtail. This will require some coding in Python on my side, but I don’t mind that. I will be able to control the look and feel of my content much better with less effort, and I will hopefully enjoy adding an occasional extension here and there.
Sending Outlook appointments with Python
Python allows you to send calendar appointments (invitations / events) directly from your code. It is quite easy to create a new appointment in the standard iCalendar format (ics). You can do it by hand or use a convenient icalendar open source module. In order to convince Outlook, however, to present the iCalendar events as native calendar appointments, you will need to make some effort. Fortunately, other people have already collected all the necessary pieces. Below is a working example for sending Outlook-friendly invitation from Python. In principle, you could use some of the information here to send similar invitation using different API, for example .NET.