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.
Announcing the Updated Flask Mega-Tutorial
I'm happy to announce that I have revised all the articles that are part of this tutorial, along with the tutorial's code repository on GitHub. The example code now works with Flask 0.10.1, and all the dependencies were also upgraded to current versions. The example application is now compatible with Python 2.7 and Python 3.3+, and I have also made several changes towards PEP8 compliance, something I did not pay too much attention two years ago when I wrote the original articles.
microblog to Python 3 required mostly simple syntax updates, but there were a couple of areas that proved tough:
- Flask-Babel has problems when used with Flask 0.10 and newer. This is related to a change in how Flask serializes the user session in this version. I have blogged about this separately, since this is likely affecting many projects unrelated to this tutorial.
- While testing full text search I have found an issue with the Whoosh package under Python 3. There is a bug report for this problem, but there is no fix yet. I have left support for full text search disabled in Python 3. I will enable it once Whoosh works well with that version.
As far as the content of the tutorials, I decided to stay true to the original articles and not introduce any major changes. That means that for those that are familiar with the tutorial there isn't any significant changes, other than the code will now work with current versions of Python and all the packages. Related to this I think it is important to note the following:
- The Database article shows how to track migrations using package sqlalchemy-migrate. Today a lot of people use Alembic instead, many through my own Flask-Migrate extension. I have covered the use of Flask-Migrate and Alembic well in my other tutorials, so I decided to stay with sqlalchemy-migrate for this one. Note that I have updated the version of sqlalchemy-migrate to the current version.
- When I wrote the Facelift article the current version of Twitter Bootstrap was 2.3.2. I have not updated the templates to work with current 3.x releases, since that is largely unrelated to the main goal of the tutorial.
- Two years ago when I started writing this tutorial the use of blueprints with Flask was new, I did not cover blueprints at all. The training material I did with O'Reilly and my PyCon presentations all have very good coverage of blueprints, so I strongly recommend that you use those to learn about this topic.
In case you have no idea what the topics in this tutorial are, here is the complete list of 18 articles, with links to them:
- Part I: Hello, World!
- Part II: Templates
- Part III: Web Forms
- Part IV: Database
- Part V: User Logins
- Part VI: Profile Page And Avatars
- Part VII: Unit Testing
- Part VIII: Followers, Contacts And Friends
- Part IX: Pagination
- Part X: Full Text Search
- Part XI: Email Support
- Part XII: Facelift
- Part XIII: Dates and Times
- Part XIV: I18n and L10n
- Part XV: Ajax
- Part XVI: Debugging, Testing and Profiling
- Part XVII: Deployment on Linux (even on the Raspberry Pi!)
- Part XVIII: Deployment on the Heroku Cloud
Recommended Flask Learning Path
I have been very prolific and created several tutorials since I completed the Mega-Tutorial. In this section I want to summarize what I have created and sort it by experience level to help you decide where to start.
- An Introduction To Flask (4.5 hour long video tutorial, paid)
- Flask Workshop (3 hour long PyCon presentation, free)
- Flask Mega-Tutorial (18 part blog series, free)
- Flask Web Development (book, paid)
- Flask by Example (3.5 hour long PyCon presentation, free)
- REST API articles (4 part blog series, free)
- Writing RESTful Web Services with Flask (45 minute long PyCon presentation, free)
- Building Web APIs with Flask (3.5 hour video tutorial, paid)
- Flask at Scale (3 hour long PyCon presentation, free)
In the near future (and until I find a next major project to absorb all my free time) I plan to return to blogging. I have several ideas for new Flask articles, many for topics I originally intended to include in my book, but then had to remove to keep the book from getting larger than originally planned (even though in the end the book ended up having about 100 more pages than the target page count!). Examples of what you can expect to see here in the following weeks:
- Creating administration interfaces
- Implementing CORS in Flask APIs
- Infinite scrolling
- Single page applications with Flask on the backend
I also expect to write a fair amount of articles related to cloud computing and in particular OpenStack, which is my current focus at work.