Live data from Hacker News

Flask 1.0 Released

palletsprojects.com

171–180 of 184 posts

Re: Flask 1.0 Released

#171
post #13

I understand that Flask has become popular because it is easy to learn, but my experience is that as your knowledge progresses it just keeps getting in your way. I particularly dislike some design choices which look like afterthought hacks, such as global variables for current request and using abort() functions instead of raising exceptions directly. EDIT: To avoid hollow naysaying, here are some alternatives to Fla…

The real value of Flask is that it makes you appreciate what Django does by default. When I first started learning Python / web frameworks, I went with Flask because it was smaller and "simpler". As my project grew however, I had to organize it. I was basically imitating what Django gives you by default, though less cleanly.

Exactly. I have used Django quite a bit over the years and have maintained a few prebuilt (by previous developers) Flask apps for clients. Recently I had a need for a small web service so I thought I'd use Flask. After days of trying to get something simple running and installing numerous packages, I gave up on Flask. I had a server with everything I needed in less than a day with Django.

Some of the design decisions of Flask just don't seem logical, such as using the db instance when defining model parent classes. Makes for strange contortions when defining multiple model files to prevent circular references or db not found errors.

  db = SQLAlchemy(app)
  
  class User(db.Model):
    ...

Re: Flask 1.0 Released

#172

Earlier quoted context omitted.

US numbers only :(

I know:(, sorry. Reason is I'm using Twilio for the text messages and non-US numbers are really expensive. Since I'm not trying to monetize it I want to make sure that I am able to fund it out of my pocket.

I don't know about non-US numbers, but you can send text messages via email for free. You can usually do that by sending the email to the user's number at their provider. There are sites on the internet that will give you the user's provider from the phone number.

For example, a user who has AT&T can receive a text by emailing it to @txt.att.net.

https://lifehacker.com/5506326/how-can-i-send-an-email-via-t...

Re: Flask 1.0 Released

#173

Earlier quoted context omitted.

True in a very large project, false on the rest. Congrats on your one-true-way argument. ;)

I'm a professional Python dev, I have no reason to believe that decorators save any time for any size of project. They're harder to reason about for developers of all experience levels and their is no obvious advantage--some argue that the syntax is more pleasant, but I don't perceive an increase in readability; certainly not one that makes up for the increased cognitive burden. The following is super straightforward…

I was thinking more of the fact the are paired with the view. To be honest never gave the fact they are decorators much thought.

Re: Flask 1.0 Released

#174
post #51
post #50

https://github.com/hack4impact/flask-base is an incredible boilerplate for Flask, I use it for every projects ! Lots of basic web stuff included, user management, redis queue for asynchronous tasks etc..

Every non-trivial Flask projects aims to become Django.

This has been my observation as well. It also seems that a lot of teams that do that are kind of snooty about Django, not realising that they've essentially invented a worse version of it.

Re: Flask 1.0 Released

#175
post #28

Flask has a stigma for not being that good when building larger apps, but honestly Flask scales really well for that type of use case (coming from a development / maintenance point of view). I have some pretty large Flask apps with dozens of top level dependencies and models spanning across many thousands of lines of code. Even if I don't touch the code base for a few months, it's easy to jump back into it. I'm also…

My employer made me switch from Flask to Django providing non-scalability reason. I asked around on a few online forums and they told me that flask has no such issues. There was an article where somebody from DISQUS explained how they were able to use flask in production without much hassel and there's no reason to switch to django. My employer told me to not use flask as it is not production grade. The problem was t…

Ah, "hit and run management"...

Re: Flask 1.0 Released

#176

wow, lot of Flask haters here. I personally love it and have used it for a ton of smaller projects. For example, I just deployed this a couple days ago: http://dadjoke.info

Another website built 100% with Flask: https://wakatime.com

Flask has scaled very well and never run into Django dead-ends, like where Django isn't flexible enough to do something and requires a hack.

Re: Flask 1.0 Released

#177
post #83

Earlier quoted context omitted.

It's bizarre there are few or no offerings in that elusive middle ground. Rails & Django seems a little heavy. Flask & Express a little lite. I've never written an app that did not need user management, sessions, admin, db access, form processing, views/templating. Web2py is the best I've found (python).

Will the needs not be satisfied with flask ext, approved or not[0]? For example: user management, sessions, admin(flask-admin), db access(SQLAlchemy), form processing(wtforms), views/templating(jinja). [0]: http://flask.pocoo.org/extensions/

Yes, I think you could definitely piece something together. And I suspect there's a starter-kit/cookiecutter somewhere that I'll look for.

Re: Flask 1.0 Released

#178
post #75

Earlier quoted context omitted.

I was about to post something similar, but this nicely summarizes my feelings. Even with DRF (for REST APIs) the extreme coupling at all layers makes things painful, though it's possible to reduce that pain a little with some carefully enforced rules. (I would like to see a way of disabling QuerySet traversing, so that if you try to access something that you didn't already prefetch_related/select_related then you jus…

Your should look into the django-seal package which enforces this sort of constraint that you're asking for

Yes, yes I should. Many thanks!

Re: Flask 1.0 Released

#179
post #13

Earlier quoted context omitted.

The real value of Flask is that it makes you appreciate what Django does by default. When I first started learning Python / web frameworks, I went with Flask because it was smaller and "simpler". As my project grew however, I had to organize it. I was basically imitating what Django gives you by default, though less cleanly.

Django has nicely integrated components, but each of flask components are better (jinja2, sqlalchemy, migrations, etc).

Those aren’t Flask components. They just work well with Flask. And Jinja, SQLAlchemy, and Alembic just happen to be the largest and best of them.

Many of these independent components pale in comparison to their Django counterparts in glaring ways—they are often a pain to use, with some pretty questionable internal code choices. They remain used because they are often the only choice out there, even though their implementations are inferior to Django’s.

I say this as someone who has used Flask for over 5 years, as well as nearly 5 years of Django.

Re: Flask 1.0 Released

#180
post #137

Earlier quoted context omitted.

There's a bit of magic in Flask - the global object is an example.

This one trips up every podcast host and blogger. It is not a global object, it just pretends to be with some wrapper magic. Like an attribute method it is not a simple variable.

Which is hardly unique to flask. A scoped bean in Spring is the same concept, if expressed in a much more verbose manner.
Post reply on HN