Jinja2 Custom Template Tags

Posted on Tue 23 March 2021 in posts • Tagged with jinja2, flask, flask-meld

Building custom template tags in Jinja2 is not an easy task. That used to be the case, which you will see below.

tl;dr: Give jinja2-simple-tags a try.

Why would you create a custom template tag?

From the docs:

By writing extensions you can add custom tags to Jinja. This …


Continue reading

Form Validation With Flask-Meld

Posted on Fri 18 December 2020 in flask-meld • Tagged with python, Flask-Meld, Flask-WTF, Flask, WTforms, Meld

Real-time form validation with Flask-Meld  

Flask-Meld now integrates with Flask-WTF to handle form validation.

What's the big deal? Real-time form validation without writing any Javascript!

Flask-Meld form validation

Of course I wouldn't leave you hanging without a way to try it yourself! Here's a link to the demo

Building your form

While you …


Continue reading

Flask-Meld, ditch JavaScript frameworks for pure Python joy!

Posted on Fri 04 December 2020 in flask-meld • Tagged with python, Flask, Flask-Meld, Meld

Introducing a new way to build web applications: Flask-Meld  

Flask-Meld demo

Try the demo yourself

Before we dive in, I would like to give credit where credit is due. This extension was heavily inspired by the following projects and people:


Continue reading

Adding Digital Ocean to Flask-Dance

Posted on Fri 13 November 2020 in conveyor • Tagged with flask, python flask-dance

In the last article we learned how to set up and use a Digital Ocean Oauth app. Now that we understand how that works, let's make all of that hard work more accessible to the rest of the Flask community. Flask-Dance is an extension that is used to complete the …


Continue reading

OAuth with Digital Ocean and Flask

Posted on Tue 03 November 2020 in conveyor • Tagged with python, conveyor, flask

The OAuth flow can be confusing the first time you do it. This article and example project should help you feel more comfortable specifically for people who would like to use OAuth with Digital Ocean.

The code for this application can be found at https://github.com/mikeabrahamsen/flask-digitalocean-oauth-example

Conveyor …


Continue reading

How to structure Flask applications part 2 - Growing up

Posted on Fri 16 October 2020 in python • Tagged with python, flask, webdev

My first introduction to Flask was Miguel Grinberg's original Flask Megatutorial. After using Django as my framework of choice for several years. Miguel's simple use of Flask allowed me to see just far enough under the hood that I started understanding much more of the web stack, hidden in some …


Continue reading

How to structure Flask applications part 1 - Small Apps

Posted on Fri 02 October 2020 in python • Tagged with python, flask, webdev

One of the benefits of using Flask is it is straightforward to get an application up and running. When you are first starting, you can create your application with a single file. The structure of the application is left entirely up to the developer.

Starting with a single file application …


Continue reading

Paving the way for Python 3.8

Posted on Wed 08 July 2020 in conveyor • Tagged with flask, conveyor, migrations

Currently Conveyor will install Python 3.6 when you create a server as 3.6 is the version that is used with Ubuntu 18. However, it would be great to have the ability to install more recent versions of Python and be able to use different versions depending on the …


Continue reading

Adding a test for the new site button

Posted on Tue 07 July 2020 in conveyor • Tagged with flask, conveyor, testing

When refactoring the new flow for creating a site the + New Site button was removed so there was only one option to add a site. If you already have a site with Conveyor we need to make sure the add site button is available.

To start I have written two …


Continue reading

Adding reCAPTCHA to a Flask site

Posted on Sat 20 June 2020 in dev-journal • Tagged with developer journal, flask, conveyor, python

This post will explain how to add Google reCAPTCHA to a Python Flask application using Flask-WTF.

The first thing you will need to do is get your SITE KEY and your SECRET KEY from Google reCAPTCHA Make sure to create a reCAPTCHA version 2 site. Version 3 takes much more …


Continue reading

The pythonic way to deploy applications

Posted on Wed 06 May 2020 in conveyor • Tagged with conveyor, deployments, linux, python, flask, django

Pythonic - an idiom used for the python programming language that encourages code readability while striving for an optimal solution to a problem.

This idiom drove a lot of decisions when building conveyor.dev

To try to make a simple solution that works for most applications.

No container orchestration, no docker …


Continue reading

Getting started with Conveyor

Posted on Mon 30 March 2020 in conveyor • Tagged with python, flask, django, deployments

Before you start

Before you get started with Conveyor you will need the following:

  • A domain name
  • A Github account
  • Digital Ocean or Linode account

Create a Conveyor.dev account

To get started you will need to create an account on Conveyor.dev

When you log in for the first …


Continue reading

Enforcing login on all Flask blueprint routes

Posted on Wed 26 February 2020 in posts • Tagged with python, flask

I found this tip on the Flask subreddit, such a simple solution to make sure you don't forget to add a @login_rquired to a route. You can enforce user login with Flask-Login by using the @before_request decorator.

@bp.before_request
@login_required
def handle_route_permissions():
    # just used to enforce login required on all …

Continue reading

Github apps: Securing webhooks with Python in Flask

Posted on Wed 15 January 2020 in github apps • Tagged with python, flask, github, conveyor, webdev, webhooks

Once you have your Github webhooks working you will want to add a bit of security to make sure that the requests are actually coming from Github. One way to do this is to verify the signature Github sends matches the digest of the message.

Here is an example of …


Continue reading

Github apps: Receiving webhooks with Flask

Posted on Tue 14 January 2020 in github apps • Tagged with python, flask, github, conveyor, webdev, webhooks

Once you have your Github app created you can start receiving webhooks when events occur.

If you want to test this locally you can use an ngrok.io address to route the request to your local computer. Instructions on how to do that can be found at https://developer.github …


Continue reading

Github apps: Creating and installing an app with Flask

Posted on Sat 21 September 2019 in github apps • Tagged with python, flask, github, conveyor, webdev, webhooks

Create a Github app to integrate with Github

demo

Using a Github app is the preferred way integrate with Github. By creating a Github app you can give your users more granular control of what you have access to. By transitioning Conveyor.dev to use a Github app the level of …


Continue reading

Create a navigation sidebar with flask

Posted on Wed 28 August 2019 in flask • Tagged with python, flask, sidebar, conveyor, webdev

Sometimes pages grow to a point that the need a little help in order to keep it intuitive for the user. I want to share one way that I have been able to keep pages organized and intuitive to the user by using a sidebar with Flask. No javascript involved …


Continue reading