IMAGE

  1. I used the Flask web framework, first.
    • Miguel’s Flask Mega Tutorial is a great way to learn Python
    • A few quick web searches for Django vs. Flask articles indicated that Flask was the way to go.
    • When I got to the data encryption part of my app, Flask was a disaster. I encountered abandoned modules and tutorials that don’t work–more so than usual for the Python community (I have a separate rant on that).
  2. I am working through the Django Getting Started tutorial, and I love it.
    • The admin page is well-integrated into the database functionality
    • The admin shell is a handy tool for keyboard warriors
  3. I have worked through a few other Django tutorials, covering things like the following:
    • Authentication Templates (login pages)
    • Social logins (ie. OAuth with Twitter, GitHub, Facebook, etc.)
    • HTML templates
    • Bootstrap (I have to mention this because one tutorial covered this particularly well)
  4. Social login is central to my Twitter projects. As such, it is something I have researched extensively while comparing Flask and Django. Offerings range from home-brewed solutions to code libraries that are actively maintained. Popular Django libraries include the following:
  5. Tweepy can also be used to authenticate, as can be seen in the following tutorial and example:

    These are fine for single-user applications, but need to be wrapped in extra code for a multi-user application.

Conclusion

What finally convinced me that Django was the better option was being able to get Tweepy working the way I wanted with Django, faster than in Flask. I am sure I could get Flask to do what I wanted, but isn’t the whole point of these frameworks to make life easier? From what I have seen, Django handles sessions (read: user data) better than Flask.

Flask is okay for spinning up small or local servers that don’t store sensitive information (aka. secrets). For projects that handle secrets or have complex data models, Django seems to be the better option. The Django Project’s tagline of “The Web framework for perfectionists with deadlines” seems appropriate.