Flask-Mail & Interview Prep

I spent some time today to review what was possible to do with Virtual Box snapshot. I was mainly confused by the "delete" state which is actually a merge. Interesting choice of vocabulary.

When it comes to Flask, I finished the overview of Flask-Mail by implementing the token module. Any user can now reset their password in a secure way. One of the highlight of the day was discovery of asynchronous requests. This way I can put processes in a thread so they don't overlap and kill my machine :<

What I did:

  • Virtual Box Stuff
  • Finishing Flask-Mail service
  • Implementing asynchronous mail sending

Next Interview

Friday we interview Hubert Turiaj who is the founder of Edisonda, one of the most important UX Design agency in Poland. They have clients such has ING, ABB or Goodyear. Pretty excited by this one as Hubert started his venture from scratch. I prepared the interview script this morning and tried to be as thorough as I could in my questions. We want to refocus in providing values in our interview, not only sharing a good time with folks. I hope it will reflect on that episode.

Routine, Flask-Mail and JWT Tokens

Since yesterday I adopted a new routine and I am pretty satisfied of it. My routine is extremely important for me. I know all too well how easy I get lost or distracted, so over the years I experimented. I will take the time to write more about this in the future as it can be useful to others.

About Flask, I implemented a web server and introduced tokens in the application.

What I did:

  • Implemented Flask-Mail
  • Created a module to reset the password
  • Used JWT Tokens to provide an additional layer of security

Cool commands learned

Not exactly a command, but one the most valuable application on macOS is definitely Keyboard Maestro. I couldn't recommend an application more.

Test and Pagination

Small update about my progress. I spent time on data models, unit testing and pagination. Implementation of features are becoming more and more natural at this point. That's the time I finally feel comfortable to implement in parallel something production-friendly. Which means allocating more time time on learning AWS and friends.

What I did:

  • Database Advanced Queries: Joins, Filters, Sorting, Union, Join
  • Unit testing
  • Pagination

Cool commands learned

  • Flake8 is the linter I use. To install it:
python -m pip install -U flake8

Then, in VS Studio:

"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.pylintEnabled": false,
  • With Flask and SQLAlchemy, the error alembic.util.CommandError: Target database is not up to date. is due to the fact that SQLite does not support renaming columns.

I messed up and that's a great thing

Today, I broke a lot of stuff and not all was on purpose.

Updating (Breaking) Ghost

I didn't update my instance of Ghost, the CMS that I use to publish this blog, since months. I thought it was more than time to do it today. One apt upgrade and ghost upgrade later, the fate of my morning was decided.

I spent most of the morning fixing this very notebook/blog. It was a great source of practice. I read logs, researched resources, restored snapshots, isolated probable causes.

That prepares myself to the moment when I will finally customize the front-end of this website.

Adding Error Handling (Breaking) Flask

Continuing my Flask studies, I practiced how to manage Error Handling. Before today, I only knew basic error handling from JavaScript. What I did went way beyond and I can see how it can help solves otherwise nightmarish issues.

What I did:

  • Activate Debug Mode
  • Custom Error Pages
  • Sending Errors by Email
  • Logging to a File
  • Fixing duplicate bug

Element Talks & Webinar

We interviewed today for Bloc Thinking Paulina Kacprzak and Olga Rafalska who are the co-founders of Element Talks, a two-day design conference organized in Warsaw the 16th and 17th of June. I will very probably go as it will be a great way to spend time with my friend Werner, meet cool people, do some live interviews and be in a different environment.

I also joined a short webinar from David Kadavy about Creative Blocks and it was a good investment in time. I liked the way he presented his concepts and how applicable his advice were.

As I am focused into learning backend and ops, I don't practice design. Short events like this one and the podcast are helping me to stay in touch with that field and that's a good thing too.

Cool commands learned

Well, surprise, most of them are related to the Ghost installation, but not only.

  • Don't play with Ghost in root folks. You can't update anyway the app with the root user.

  • If you use the Ghost CLI like most people, it's critical to have it updated before proceeding with a ghost update

npm i -g ghost-cli
  • The command ghost run will give you more detailed information in the running log than ghost start

  • To view the journal log of the last Ghost events

journalctl -u ghost_yourdomain-com -n 50
  • Useful folders: default Ghost install at /var/www/ghost and default nginx conf files at /etc/nginx/
  • To restart nginx
/etc/init.d/nginx restart
#service nginx restart possible
  • To restart a machine via an interactive terminal session, you need first to enable it
systemctl enable poweroff.target
  • To know which ports your machine is listening to :
netstat -plnt

Fun Stuff

In things I wasn't expecting to discover but make total sense, an art-focused MMO would be pretty high. Thanks to Freakhill for that link 🐱!

Wrote, Studied, Discussed

I reviewed my organization last week-end in light of the experience of those past weeks. Time will tell if this iteration help me improve, however I have a good feeling about it. I simplified it, keeping my focus on my professional practice while not neglecting the well-being of my couple. On another topic, I wrote about Bloc Thinking for the first time on LinkedIn. The reception was pretty positive, so this is an experience to renew.

Those two updates aside, let's come back to my Flask practice.

Progress Check: 1/4

I completed two chapters since my last note. Finished the last items of the chapter 5 on User Logins and completed the chapter 6 on Profile Page and Avatars. I updated my Flask Notebook as always with my highlights. I am going to a more concise style on recent items. My end goal is to use those notes as a quick reminder tool, my own cheat-sheet, when it comes to Flask.

What I did:

  • Logout function
  • Requiring user to login
  • Prevent malicious attacks on redirect
  • Creating a registration page
  • Create user profile page
  • Add avatar
  • Manage sub-templates
  • Let the user edit profile information

Future Tasks

Last week after a discussion with Grinkers, we highlighted my work plan for the coming weeks. It is something I will have to manage in parallel with the core Flask knowledge I am acquiring. Here is the gist of it:

  • Create a run.py file for somebody to run it in one step.
  • Access data from the terminal. Telnet, JS, Python etc. Right now, I am building a front-end base framework but I need my users to be able to access those data directly.
  • Create routes to @lobby and @join
  • Take into account the effects of Long Polling. What would would happen if tokens expire during a long poll?
  • Set-up on AWS, Docker
  • Extract analytics

I have to admit that I felt quite overwhelmed after that discussion. At the same time though, I am advancing at a correct rhythm since I was able to commit consistent effort. So yeah, moving forward 🚀.

Cool commands learned

Not a command, but with jinja2.exceptions.TemplateSyntaxError issues, to debug, instead of commenting it is necessary to delete the doubtful code. I lost at least an hour trying to fix an issue and I realize that commenting wasn't taken in account by the Jinja engine 😩.

Databases and notebooks!

I worked pretty well today. My understanding of Flask is getting better and I feel that I am getting somewhere. But before talking about that, a brief update on the podcast.

Justin Avery, A digital specialist with an analogue secret in his back pocket

Like every two weeks, those last few days have seen the rush for the publication of the latest episode of Bloc Thinking. It's a good one, we interviewed a web developer who decided that his next step was going to create notebooks. Like physical, tangible, touchable notebooks. It's a great insight in the life of someone who just focus on solving the problems he sees in front of him.


Still following the Flask Mega-Tutorial, I went through the Database chapter and started the User Login one. I still focus on understanding enough to move forward confidently. I am not blitzing, but I'm neither going too slowly. I know I will get back to all those context anyway. The tutorial uses SQLite, which is perfect in my context.

What I did:

  • Flask-SQLAlchemy and the concept of Object Relational Mapper (ORM)
  • Database settings as config
  • Database models setup
  • Init Database
  • Migrate databases
  • Setup databases relationships
  • Querying
  • Flask Shell command
  • Password hashing
  • Flask-Login package
  • Logging Users In

Cool commands learned

  • Exit git logs with q

  • Retrieve the history of commit in chronologic order

git log --reverse --oneline
  • Rewriting the most recent commit message
git commit --amend
  • Remove file from previous staging
git reset HEAD path/to/unwanted_file
  • Remove file from previous commit without cancelling the change
git reset --soft HEAD^ 

git reset HEAD path/to/unwanted_file

git commit -c ORIG_HEAD  

It's Happening!

The Logging Form Quest ✅

Or at least, I created a functional form login that uses tokens using the Flask-WTF package.


Now there is nothing behind, but it manages form validations, POST method and url generation. Very happy about that! I updated my Flask notes to reflect some of that. It's on my GitHub.

The next step now is to link all of that to a database, as for now I use mock content.

What I did:

  • Loop statement with the for control structure in templates
  • Template inheritance
  • Concept of extensions in Flask
  • Saving configuration variables in application
  • Importance of SECRET_KEY
  • Form user login, templates, views & validation status
  • URL generation

Finishing this week podcast

I will probably be the longuest episode. It was a great discussion and we recorded too much content. There is a lesson to be learned here for our next recording.
On a related topic I didn't find any tool enabling to edit out automatically long syllables and hesitation sounds. It actually strange to me that such a tool doesn't exist and I wonder how feasible it would be to create one as the shape of those sounds is really similar.

Cool commands used

Visual Code Studio: ALT + Z : toggle word wrap, which is actually very practical on a limited screen.

Templating with Flask

I continued today my journey through Flask, still using the Flask Mega-Tutorial. I got the importance of creating Mock objects as you don't want to have to build in detail all parts of your applications when you are starting it. Templating was also something very fun to learn. Once you get that only what is in enclosed in {{ ... }} sections is dynamic, is easy to get.

What I did:

  • Created a mock user
  • Created template file in subsequent app/templates directory
  • Modified my routes.py file to take into account the change
    • Used the function render_template
    • render the template by running my web server
  • Setup first conditional statements with {% ... %} blocks.

I updated my Flask notebook here.

Preparing the next podcast episode

I spent the rest of the working day editing sound. We have a podcast episode to publish this Monday and I am in charge of the full edit. The recording was particularly long so it's even more work than usual. I am 30% done, hopefully will finish this Friday. To edit I use a DAW[1] called Reaper. There was a steep curve learning about it and voice audio-editing in general, however it was worth it. I will create also a notebook about that pretty soon.

Cool commands learned

Em-dash directly with Ctrl+Shift+U, then 2 0 1 4 and Enter (source)

  1. Digital Audio Workstation ↩ī¸Ž

Flask, Here We Go!

Today, after updating Xubuntu to 18.04, I (re)started to learn Flask.

Heading up in the Flask Mega-Tutorial

The way I initially started to learn Flask at the end of January was chaotic. I had a goal in mind for an application to create. So I researched instructions on how to achieve this specific goal. The main problem with this method that emerged later is that I did so without understanding the fundamentals of Flask and back-end development in general. The second issue is that I was unfocused, as I was distracted by conferences where I participated as a volunteer, the podcast I was just starting at that time, a UX engagement that was looming over me and some nagging health issues that put me out a few weeks. A perfect storm. I ended quite ashamed after realizing that really, I didn't understand much of back-end despite already being more than 4 months in my transition.

Grinkers told me to go back to the basics and it's what I am doing now. When I started to learn, I did the Flask official tutorial but despite completing it, there were a ton of points I couldn't understand. I think it was made for people already having some back-end experience, wanted to get into Flask. I needed something suited for somebody like me, a guy still not totally at ease with coding and a total beginner about back-end development.

After some Reddit research on /r/python, I decided to start with "Flask Mega-Tutorial" from Miguel Grinberg.

What I did:

  • Installed a Python based webdev environment on Xubuntu (GitHub, Python3, Pip). I documented the process here.
  • Setup a Python virtual environnement
  • Setup a very basic Flask web server. Introducing __init__.py, routes, view functions, decorators.
  • I created a Flask Notebook here that I will update with all the new stuff I learn about Flask there.
  • I learned more about Virtual Box, specifically snapshots, by reading this article.

The Flask part was fluid. Where I lost some time was during the Python setup due to a few broke items, for example "gnupg : Breaks: software-properties-common". Fortunately I figured it out. It's also part of the experience to fail a lot now, so I can be in control once I will actually ship stuff.

Cool commands learned

  • List all the apps installed on your Ubuntu installation
apt list --installed
  • Check if binaries are installed (e.g. different version of Python)
type python3 python2 python

A good day of learning overall, up to the next one now!

'Document, document, document'

I spent the day setting up a Linux VM machine that will be the host of the most of my backend development and ops tasks. I learned a ton during that process and started a long page of notes on this topic here: https://jaygall.com/setting-up-linux-vm/

I go through the configuration of VirtualBox itself and the install of Firefox Dev Edition, VSCode, Git, Docker, Pidgin with the Matrix addon. All on Xubuntu 16.04.

I actually started on Ubuntu but it was really slow on my mac despite optimizations. I was suggested Xubuntu and I decided to try it and its lightweigth XFCE desktop. Very happy about the output, the OS is snappy even in a VM.

I also submitted my first edit to AskUbuntu on this topic: https://askubuntu.com/questions/548003/how-do-i-install-the-firefox-developer-edition. It's a very slight one that might be approved soon on the correct name of the Firefox Dev icon. It's mozicon128.png and not default128.png. It's not much but that could help somebody else.

That's a good first day.