Testing File uploads in Flask

I was recently writing Flask integration tests for a form that had a file upload parameter. As it turns out, is isn't as straight forward as I had thought it would be. A basic file upload test might look like this: def test_logo(self): data = dict(logo=(io.BytesIO(…

Flask-WTF tricks

I use Flask-WTF's What the Form module for most of my Flask projects as it takes care of things like csrf tokens and so on which is a nice piece of mind. I have recently come across a couple of really powerful features that have been hiding from me in…

Error Logging

Putting an app live can be nerve racking. Who knows what will go wrong once it's released into the wild. So if something breaks you want to know about it with as much detail as possible. In debug mode, Flask provides some really helpful debugging information with a full stack…

Google Login

In the next few days we'll be rolling out Google OAuth authentication so users can login with their Google accounts rather than having to remember yet another password (although everyone should just be using 1Password). I started off using Flask OAuth but it doesn't properly support Python3 and seems to…

Building queries with Flask-SQLAlchemy

I guess it's probably about time I wrote about a bit of code on this little blog of mine. [SQLAlchemy](http://www.sqlalchemy.org/" title="SQLAlchemy) is a 'Python SQL Toolkit and Object Relational Mapper'. As we know Flask is pretty barebones but there's plenty of extensions including…

Flask vs Django

Deciding how you are going to put your website together is clearly an important decision. You generally need to make that decision up front and it will go on to haunt you for some time. As I've already mentioned I've decided to go with Python rather than PHP, but I've…