Codementor Events

Deciding on a python web framework.

Published Dec 26, 2017

Python

So, I’ve been into python development for a while, I’ve started making websites using python a while ago, I primarely used Flask, but depending on the case, Flask isn’t always the best option.

Factors

You need to take a few things into consideration when choosing a new framework for anything, in this case I take these factors into consideration:

  • Asynchronous or not
  • Simplicity
  • Size of your project
  • Availability (What platforms is the library/its dependencies available on)
  • If you have a small project, you don’t need over-complicated code, you can stick with a basic framework, for larger projects, go for a more complicated and more powerful/feature-rich framework.

The decision
I start looking at different web frameworks, Django, Flask, Japronto, Tornado, etc.

When I wrote this post, I was working on a relatively small project where an asynchronous framework is required. Seeing as its a small project, I don’t need much of a complicated framework. At first I was kind of interested in Japronto, then when I started looking into it, turns out one of its dependencies cannot be installed on windows, while I never recommend running production instances of any project on windows, I personally use it for development, meaning Japronto was off the list. Flask isn’t asynchronous, thats off the list. Django is too complicated for my needs, what I want is just a simple application using only 1 file, it also is not async, Django was off the table, then I started looking for specifically asynchronous web frameworks for python, then I stumbled across Sanic, an asynchronous framework based on Flask, normally I would use Flask for small applications, and seeing as Sanic works very similar to Flask, I like it, 1 downside though, you need to set an env variable on windows to not install dependencies not available on windows, but in the long run, that shouldn't matter.

My decision in the end was Sanic, an asynchronous framework based on Flask

Discover and read more posts from Jori van Ee
get started
post commentsBe the first to share your opinion
Paulo Scardine
6 years ago

Django now has Django Channels for when you need asyncio and websockets.

Show more replies