Category: Flask

2015-01-01T23:54:07Z

Using Celery With Flask

The topic of running background tasks is complex, and because of that there is a lot of confusion around it. I have tackled it in my Mega-Tutorial, later in my book, and then again in much more detail in my REST API training video. To keep things simple, in all the examples I have used so far I have executed background tasks in threads, but I always noted that for a more scalable and production ready solution a task queue such as Celery should be used instead.

My readers constantly ask me about Celery, and how a Flask application can use it, so today I am going to show you two examples that I hope will cover most application needs.

109 comments

2014-11-17T15:40:16Z

OAuth Authentication with Flask

Many web sites offer users the option to use a streamlined single-click registration and login built on third party authentication services, typically run by the big social networks. In my Flask Mega-Tutorial I showed you how to use one of these protocols, called OpenID.

In this article I want to give you an introduction to the OAuth protocol, which these days has replaced OpenID as the preferred third party authentication mechanism. I will also show you a complete Flask application that implements "Sign In with Facebook" and "Sign In with Twitter" functionality. With these two implementations as a guide you should find it easy to add any other OAuth providers you may need.

107 comments

2014-10-20T04:02:03Z

Video Streaming with Flask

I'm sure by now you know that I have released a book and a couple of videos on Flask in cooperation with O'Reilly Media. While the coverage of the Flask framework in these is fairly complete, there are a small number of features that for one reason or another did not get mentioned much, so I thought it would be a good idea to write articles about them here.

This article is dedicated to streaming, an interesting feature that gives Flask applications the ability to provide large responses efficiently partitioned in small chunks, potentially over a long period of time. To illustrate the topic I'm going to show you how to build a live video streaming server!

200 comments

2014-09-28T01:32:37Z

The Flask Mega-Tutorial: Now with Python 3 Support

After more than a year working on various projects on the side of my day job, I have now found some time to rest and return to the blog, which I haven't cared for much during this time.

The number one problem I see from my readers is issues when trying to follow my Flask Mega-Tutorial using current versions of Flask, its extensions, or Python 3. In this article I quickly describe the updates I have made to the tutorial.

23 comments

2014-09-23T16:38:06Z

Using Flask-Babel with Flask 0.10

One of the interesting problems that I had to address when porting my Flask Mega-Tutorial to Flask 0.10 was in supporting Flask-Babel. There is an issue when a "lazy" text generated with the lazy_gettext function is flashed. This issue was reported more than a year ago and hasn't been addressed yet.

In this short post I will show you how I solved this issue for the Mega-Tutorial, as this solution is applicable to any Flask project.

10 comments

2014-05-28T14:54:02Z

My Flask Web Development Book is Out!

Posted by Miguel Grinberg under Python, Flask.

It was a long wait, but my book is finally here! You can now buy Flask Web Development at most online bookstores, and if you are lucky you may also spot it at some brick and mortar retailers.

With the book out in the wild I thought an update is in order. In this post I will give you a summary of what I have done so far with regards to Flask training, and will conclude with the next projects that will be coming in the near future.

23 comments

2014-02-10T03:46:26Z

Easy WebSockets with Flask and Gevent

This weekend I decided to take a short vacation from my book writing effort and spend time on a project I wanted to work on for a long time. The result of this effort is a brand new Flask extension that I think is pretty cool.

I'm happy to introduce Flask-SocketIO, a very easy to use extension that enables WebSocket communications in Flask applications.

345 comments

2013-12-24T01:26:25Z

Flask Book and PyCon Update

With my book already available for pre-order at Amazon.com I thought an update is in order.

21 comments

2013-11-28T07:33:19Z

RESTful Authentication with Flask

This article is the fourth in my series on RESTful APIs. Today I will be showing you a simple, yet secure way to protect a Flask based API with password or token based authentication.

150 comments

2013-11-05T07:03:42Z

Flask-PageDown: Markdown Editor Extension for Flask-WTF

(I can't help it. I keep coming up with ideas for cool Flask extensions.)

If you've asked or answered a question on Stack Overflow you have seen the editor that they use. You type your text using Markdown syntax in a standard text area HTML control and below it a preview is generated as you type. This editor is powered by an open source project called PageDown.

Today I'm introducing Flask-PageDown, a wrapper extension that makes it really easy to add this control to your Flask-WTF based forms.

21 comments