News for hackers. Stuff that matters.
Re:Flask 1.0 Released by jxub on Thursday April 26, 2018 @05:20PM (#16935913)
This is epic. In theory now from V1 onwards it should be easier to convince people at big serious corps to use Flask as it cuts down a lot of Django bloat especially for smaller applications, microservices and other nimble backends.
Re:Flask 1.0 Released by deft on Thursday April 26, 2018 @05:33PM (#16936037)
Hopefully! There's a bad attitude I've noticed about Flask, people don't take it seriously and treat it like a learning tool or a library for quick and dirty hack projects. All because it's simple to learn and free of bullshit and Just Works™. Should lead to the opposite attitude, but nope. People apparently enjoy extra complexity.
Re:Flask 1.0 Released by cuchoi on Friday April 27, 2018 @01:21AM (#16938613)
There is a similar feeling towards SQLite
Re:Flask 1.0 Released by weberc2 on Thursday April 26, 2018 @05:50PM (#16936193)
I think a lot of criticism is valid. Flask has a lot of bizarre conventions which don't scale well, like stuffing all shared resources into the global context or app-level dicts and using `@route()` decorators all over, for example. And I'm not sure what the benefit is, except that clever feeling one gets when they use decorators or other seemingly magical features unnecessarily and later need to workaround the tight coupling.
Re:Flask 1.0 Released by mixmastamyk on Thursday April 26, 2018 @10:20PM (#16937995)
Decorators improve dev speed. No need to be constantly switching back and forth between views and urls.py.

Still, sometimes nice to see all in one place.

Re:Flask 1.0 Released by scaryclam on Friday April 27, 2018 @03:13AM (#16938981)
They only improve speed from an initial "get it working" point of view. That's part of the reason flask is rarely taken seriously as a production solution. Not having natural separation between views and urls is a real PITA for anyone trying to create a long term solution or larger project. For what it's worth, I also hate the argument that bad design increases Dev speed. That's only true until you need find something later, then you have to hunt around instead of having one place to look, wiping out any initial gains. It's false economy.
Re:Flask 1.0 Released by aregsarkissian on Friday April 27, 2018 @11:21AM (#16941427)
FYI with flask you don't have to use decorators for routing. You have the option to define all your routs in a single file.
Re:Flask 1.0 Released by mixmastamyk on Friday April 27, 2018 @11:34AM (#16941551)
True in a very large project, false on the rest. Congrats on your one-true-way argument. ;)
Re:Flask 1.0 Released by weberc2 on Friday April 27, 2018 @12:36PM (#16942124)
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, testable, and it doesn't depend on globals for shared resources or request state:

    def hello_handler(r: Request) -> Response:
        return Response.ok("Hello!")

    def goodbye_handler(r: Request) -> Response:
        return Response.ok("Goodbye!")

    if __name__ == "__main__":
        router = Router("/")
        router.register_route("/hello/", "GET", hello_handler)
        router.register_route("/goodbye/", "GET", goodbye_handler)
Re:Flask 1.0 Released by mixmastamyk on Friday April 27, 2018 @03:03PM (#16943367)
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 by ryannevius on Thursday April 26, 2018 @05:32PM (#16936029)
You don't have to use the Django "bloat": https://github.com/syntarsus/minimal-django
Re:Flask 1.0 Released by aphextron on Thursday April 26, 2018 @10:47PM (#16938105)
What's your application server setup like? Is there a standard for this? I tried using UWSGI and Gunicorn with varied results. It was just a pain to setup. I hope things have improved.
Re:Flask 1.0 Released by acostanza on Thursday April 26, 2018 @11:27PM (#16938257)
I found it pretty easy to set up with Gunicorn and nginx, all running in Docker
Re:Flask 1.0 Released by abhishekjha on Friday April 27, 2018 @12:01AM (#16938375)
Is there any definite tutorial to set it up with Gunicorn and ngnix? I have used gunicorn before but not with ngnix.
Re:Flask 1.0 Released by PokemonNoGo on Friday April 27, 2018 @04:35AM (#16939286)
Same setup as the other reply. Gunicorn and flask in docker. Works perfectly and is speedy.