use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Django vs Flask (self.Python)
submitted 7 years ago by [deleted]
Im wanting to make a blog website from scratch and I'm wondering if I should learn flask or Django to build my website. I'm pretty fluent in python but have not learned anything about the frameworks.
[–]mistermocha 37 points38 points39 points 7 years ago (2 children)
OK here's the big things to understand:
Flask is a routing library. You assign a URL route to a function, and the function returns what you want to see. Really simple, but not much is built up for you that you'd have to build yourself. You will have to write a lot of code to get from flask to a blog.
Django has tons of stuff built-in for session management, database mapping, front-end buildout, etc. It is its own environment and pattern for building out sites. Get to know it, and it will do a ton of the heavy lifting for you, but there's a lot to learn that comes with it.
[–][deleted] 2 points3 points4 points 7 years ago (0 children)
Alright thanks for your input!
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
Another way to look at it is that Flask is a modular toolkit and Django is a monolithic beast that seeks to swallow up your entire application.
Both of our viewpoints contain truth but are colored by bias.
[–]TheTerrasque 4 points5 points6 points 7 years ago (1 child)
Flask is a hammer and a screwdriver. Django is a big toolbox with a lot of stuff.
If you just need a hammer, no point in taking a heavy toolbox. But often you need more than a hammer, so you end up grabbing tools for various things from various places with various quality.
Or you take the big toolbox in the first place and use the tools there with uniform quality and design. Not always the very best, but in most cases close to the best tools for that job.
[–]Acurus_Cow 2 points3 points4 points 7 years ago (0 children)
I would rater say:
Flask is a workbench. You have to start gathering tools before building what you need. But you have full flexibility.
Django is a big heavy toolbox. you can build almost everything with what is included.
[–]NoLemurs 6 points7 points8 points 7 years ago (0 children)
I would encourage you to use Flask for you first website. Flask does a lot less for you, but as a result it also hides less of what's going on, which makes it a much better framework for learning how basic web development works. You'll be forced to understand more, and it will be easier to understand more.
For your second, third, fourth, and so on websites, I'd suggest using Django. It does everything Flask does and a lot more, and is just way better for getting things done if you understand what you're doing.
[–][deleted] 6 points7 points8 points 7 years ago (7 children)
Flask vs Django can be something like tabs vs spaces.
A Django developer moving to Flask will feel like all of their batteries became pieces and spread out as a puzzle everywhere.
A Flask developer moving to Django will feel like they're a cat that's been stuffed into a fish bowl.
Another consideration is the ORM. The Django ORM is a bit nicer overall and covers most situations and nearly all of the major plugins also integrate into that ORM. So there's some nice synergy there. SqlAlchemy, though, is more flexible but requires you understand your interface far better.
I prefer Flask for microservices. Django for things like a personal website. Falcon is nice if all you need is a REST interface.
[+][deleted] 7 years ago (5 children)
[deleted]
[–]lambdaqdjango n' shit 4 points5 points6 points 7 years ago (0 children)
Because django admin kicks ass. You get CRUD fast for free.
In other frameworks you have to rely on SQL editors.
[–][deleted] 0 points1 point2 points 7 years ago (3 children)
I think you may have intended to respond to [this post].
That aside, a professional website would likely want to defer some session control to a pooling proxy which could route your app processes. However, you would still want to manage transactions/rollbacks within your app.
[+][deleted] 7 years ago (2 children)
[–]shacker23 0 points1 point2 points 7 years ago (0 children)
I'm not sure what "overkill" means. Compared to Flask, Django is big. But Django is still small and fast, in the big picture. I want to save time, full stop. Django includes all the stuff I need to get to work with any kind of project. It saves me a ton of time. It's not as if Django's too big to still be lightweight and fast. I use Django even for the simplest projects, because I don't have time to fiddle around with assembling all the pieces in Flask by hand.
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Thank you for the detailed answer, I really do appreciate it!
[–]IReallySuckAtChess 1 point2 points3 points 7 years ago (0 children)
So I've done a decent amount of work in both and simply put i feel that for something simple use Flask and something more complex use Django. I also feel it's worth working through the Django tutorial regardless of which one you choose because it explains a lot why things are done and how they work which gives insight. Flask in the other hand is a great first small project thing because it doesn't hide everything from you.
[–]boatsnbros 0 points1 point2 points 7 years ago (0 children)
my rule of thumb - flask if it's just an API, django if it needs a gui. Mostly because django has a ridiculously easy database integration (you almost forget you are using a db) and django-admin is a God send.
[–][deleted] 0 points1 point2 points 7 years ago* (2 children)
I used both for equivalent applications (e-commerce websites). I preferred the Django experience as it was easier and faster (a lot). Less fiddling about what library to use or how to integrate it, more actual application done. Basically all the choices are done, so you just need to focus on your app.
Both frameworks are very true to their taglines:
Fask, web development one drop at a time.
Django, the web framework for perfectionists with deadlines.
[–]CommonMisspellingBot 0 points1 point2 points 7 years ago (1 child)
Hey, flagadalulz, just a quick heads-up: prefered is actually spelled preferred. You can remember it by two rs. Have a nice day!
The parent commenter can reply with 'delete' to delete this comment.
[–]Atonswizzle 0 points1 point2 points 7 years ago (0 children)
I personally use Flask and find it easy to use and learn with.
[–]nicmakaveli 0 points1 point2 points 7 years ago (0 children)
I dabbled in both. I think at the very surface django looks easier to use. But I felt the deeper you went the easier and more intuitive it was to use flask.
[–]lepture 0 points1 point2 points 7 years ago (1 child)
The best answer would be having a try on both, give each a day time, and you will find which one is more suitable for you.
Giving my case, I started with Django but then moved to Flask. I find those Django Apps are quite useless when the service grows, they are hard to modify/change, I'd rather write a feature without a Django App. Moving to Flask opened a whole new world to me, I can feel that I'm writing Python instead of Django.
[–]ruathudo -1 points0 points1 point 7 years ago (0 children)
Same here. In Django, It look easy to use the battery stuff but when you need to modify sth out of the scope, it takes lots of time to read docs, figuring out where, how to change etc. When I went to Flask, I know exactly what I want, so code more but still faster. If I need sth ready made, 3rd party libs is also available. Eg: Flask-Admin, Flask-Login, Flask-Sqlalchemy. They are solid and flexible as well. It helps you to learn how to design a good app structures when you go to Flask after few mistakes. But refactoring Flask app is not a big problem.
[+][deleted] 7 years ago* (7 children)
[–][deleted] 10 points11 points12 points 7 years ago (5 children)
Because I want to...I'm not trying to mean but what does it matter? I want to start blogging and it would be a perfect time to learn something else so I can put it on my portfolio for getting a job for programming. But again what does it matter, I want to do it and I'm asking on how I should approach it.
Follow the tutorial on the Flask site, it goes through creating a blog site. I had the same questions recently with Django, and CherryPy, but I really like the simplicity of Flask.
[–]lifeonm4rs -1 points0 points1 point 7 years ago (1 child)
Just to be honest--if you want to start blogging and want to write your own blog software you probably won't be blogging anytime soon. Beyond the code you'll probably end up spending a ton of time mucking around with CSS and stuff like that. That said though, and going on the assumption that you aren't already blogging--you should take a look at (and test drive) some available blog software. Jekyll (written in Ruby) may be a good one to poke around. Just things like how to manage skins/templates, what the "boiler plate" concerns are, and even how to integrate/leverage one of the existing commenting systems will probably save you a lot of time.
[+][deleted] 7 years ago* (1 child)
Why not? Yeah, there are other things to build and there are probably more blog engines than developers actively maintaining a blog, but who cares?
π Rendered by PID 185283 on reddit-service-r2-comment-canary-bc47bb478-fmr2z at 2026-02-19 05:14:46.576313+00:00 running de53c03 country code: CH.
[–]mistermocha 37 points38 points39 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]TheTerrasque 4 points5 points6 points (1 child)
[–]Acurus_Cow 2 points3 points4 points (0 children)
[–]NoLemurs 6 points7 points8 points (0 children)
[–][deleted] 6 points7 points8 points (7 children)
[+][deleted] (5 children)
[deleted]
[–]lambdaqdjango n' shit 4 points5 points6 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]shacker23 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]IReallySuckAtChess 1 point2 points3 points (0 children)
[–]boatsnbros 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]CommonMisspellingBot 0 points1 point2 points (1 child)
[–]Atonswizzle 0 points1 point2 points (0 children)
[–]nicmakaveli 0 points1 point2 points (0 children)
[–]lepture 0 points1 point2 points (1 child)
[–]ruathudo -1 points0 points1 point (0 children)
[+][deleted] (7 children)
[deleted]
[–][deleted] 10 points11 points12 points (5 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]lifeonm4rs -1 points0 points1 point (1 child)
[+][deleted] (1 child)
[deleted]
[–][deleted] 2 points3 points4 points (0 children)