16 ms·
Flask 1.0 Released
- ryanar 8y agoAwesome news! I am sad to see you leave Zero Versioning though. [1] [1] https://0ver.org/#notable-zerover-projects https://0ver.org/#notable-zerover-projects
- Volt 8y agoWhy is Zero Versioning a good idea?
- dfinninger 8y agoI believe the parent comment and ZeroVer are tongue-in-cheek. Reading through the site brings Poe's Law to mind.
- mhashemi 8y agoWas it the literal link to https://en.wikipedia.org/wiki/Poe%27s_law https://en.wikipedia.org/wiki/Poe%27s_law on https://0ver.org/about.html https://0ver.org/about.html ? :P Countless people are already using 0ver, and always will. In other words, 0ver.org is descriptive, not prescriptive.
- deft 8y agoNever even realised it wasn't 1.0, maybe I should pay attention to version numbers. Changelog looks good! I've never understood logging in Flask or how to do it in a sane way for a simple app while using uWSGI, so I'm glad that has some improvements. I don't remember my exact issues but I couldn't get configuration from a text file to work and for some reason configuring it in-code wouldn't work either. I don't understand python's logger in general so I'm sure that's part of the problem. The changelog is vague on details, but hopefully whatever was modified really does make things simpler and solves my issues for me.
- avip 8y agoMy processes always log to stdout. stdout + supervisor + rsyslog = fun and profit. You can also log directly to rsyslog with python logger.
- abhishekjha 8y agoI have been logging to stdout mostly. Never used/heard of supervisor or rsyslog. What are their use cases?
- deleted 8y ago[deleted]
- memonkey 8y agoLove Flask. It is my favorite back-end framework and has fit all of my needs. Getting a server up and running with Flask is incredibly simple and if anybody hasn't played with it yet, I highly recommend it.
- GrandNewbien 8y agoIt's all fun in games until the project you just started yesterday already needs an, albeit simple, upgrade.
- metalliqaz 8y agoFlask is an interesting project. Created by a true Python master only to be nearly abandoned, and yet it remained so popular it was later revived by a new group without a major fork. How often does THAT happen? The post describes it as "stable for a long time" :)
- Siecje 8y agoIt wasn't abandoned it just doesn't need very many updates anymore. Also there was no new group this is the official Flask repo.
- papito 8y agoFlask does what it was intended to do. To add more stuff to it would defeat the purpose, and turn it from a micro-framework into a regular framework. If a micro-framework adds a "web forms abstraction", honestly, run the other way.
- jxub 8y agoThis 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.
- ryannevius 8y agoYou don't have to use the Django "bloat": https://github.com/syntarsus/minimal-django https://github.com/syntarsus/minimal-django
- Walkman 8y agoLOL
- deft 8y agoHopefully! 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.
- weberc2 8y agoI 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.
- mixmastamyk 8y agoDecorators 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.
- BerislavLopac 8y agoI 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 Flask I find much better designed: - Tornado Web Framework [0] - Falcon [1] [0] http://www.tornadoweb.org/en/stable/webframework.html http://www.tornadoweb.org/en/stable/webframework.html [1] https://falconframework.org/ https://falconframework.org/
- weberc2 8y agoI agree. I particularly like Go's web ecosystem. A web server is just a function, and that function is often a composition of other functions (for example, a tree of router functions and then a handler for each route). By contrast, it seems like Flask goes to great lengths to obscure such a simple concept (decorators for routes, global variables for state and resource management, etc).
- icebraining 8y agoI wouldn't call it obscure, it's just an abstraction. But you can always use the underlying library (http://werkzeug.pocoo.org/ http://werkzeug.pocoo.org/), which does send everything through a function. Or just implement WSGI directly.
- weberc2 8y agoIt's not a very good abstraction, because (as previously mentioned) it depends on global variables to manage shared resources (e.g., connection pools) and even request state. Hence "obscure". It would be much cleaner to just define a handler type with the signature: `def handler(r: http.Request) -> http.Response`. Those handlers could be passed to routers (which themselves could be handlers), for example (not tested): class Route(typing.NamedTuple): path: typing.re.Pattern method: str handler: http.Handler class Router: def __init__(self, routes: typing.List[Route]) -> None: self.routes = routes def serve_http(self, r: http.Request) -> http.Response: """serve_http implements the http.Handler interface""" for route in self.routes: if route.path.matches(r.path): return route.handler(r) return http.NotFound("404 NOT FOUND") Note that since handlers are just functions, they can also be methods with object-level state. They needn't depend on global state at all, for example, notice how the following routes don't depend on the connection pool (or the request state) to be global: class Server(typing.NamedTuple): db: DBConnPool def first_route(self, r: http.Request) -> http.Response: """first_route uses shared `db` resource.""" pass def second_route(self, r: http.Request) -> http.Response: """second_route uses shared `db` resource too!""" pass
- oca159 8y agoI don't understand why use Flask instead of Django, I usually work with a lot of crud systems, I think that Django is the best option to do it. I think that Django is better because it has an autogenerated admin site and this is really helpful when you work with the customers, they can easily populate the database while you work in the logic
- cuchoi 8y agoDjango is pretty good at that! I think we usually try to compare frameworks to an extreme when partly it boils down to the type problem and the developer preferences.
- erikb 8y agoDjango was the main reason I started with Python. Really loved it more than Wordpress or Rails. However, Flask is just much simpler to get started. So nowadays, where I mostly have to achieve the most bang for a given set of bucks I usually choose Flask.
- staticelf 8y agoI have worked with the Django some, but not a lot, but I always find the admin site a bit frustrating and hard to configure and style. Maybe it's just my lack of knowledge and experience about Django, but it often times seems faster to generate a crud admin interface in many other frameworks like asp.net. Otherwise I am a big fan of Django, I think it is possibly the best web dev framework out there even if I work in asp.net for most of the time.
- adjkant 8y agoFlask is an absolutely amazing experience for small-mid sized projects. You have to hand roll and pull in things for bigger projects, but I think it's great when you want "just what I need and nothing extra". I'd be curious to see some sort of flask "bundles" that would allow it to make more sense for large-scale projects.
- nickjj 8y agoFlask 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 a huge fan of Rails, but truthfully I find Flask apps to be easier to reason about and hack on once they grow to a decent size, simply because Blueprints make it really straight forward and intuitive to modularize your application without increasing the complexity of everything by using micro-services. If anyone wants to jump into Flask and start building real world apps, you may want to check out https://buildasaasappwithflask.com/ https://buildasaasappwithflask.com/. It's a full blown course where we build a SAAS application using Flask and Docker. I recently added a free RESTful API bonus section to the course and now that Flask 1.0 out, I'll be adding another free update which will cover updating all of the packages in the main app. Just going to wait for the dust to settle on the 1.0 release first.
- devy 8y ago> Flask has a stigma for not being that good when building larger apps Not sure how to quantify that "large" but I've worked on some api backend services written in Flask with a quarter million lines of python code and not feeling "outgrowing" Flask. Granted, it took some good design and effort to make all piece s work together. These days, horizontally scale apps is the way to go.
- mixmastamyk 8y agoLove Flask in theory. My biggest complaint was trying to do user management with it. Flask-Security was good, but the developer skipped town a few years ago. Did they come back? :D Basically you are left to your own devices, which sounds great, but user+auth is pretty fundamental to be left to a random absentee third-party in my opinion.
- icebraining 8y agoYet no Flask application I've ever written needed user auth :)
- mixmastamyk 8y agoIndeed, its a risky choice for that.
- diminoten 8y agoTry farming out the auth to a middleware. That's what I do and it works really well.
- tudelo 8y agoLike openam? or what do you suggest.
- mixmastamyk 8y agoDoes it interface with sqlalchemy, onboarding, email, etc?
- diminoten 8y agoYour auth middleware can attach a user object to environ that your downstream apps could reference. Whatever else you do (email, onboarding, sqlalchemy) you can do downstream, or directly in the (or a different ) middleware if you want.
- whitehouse3 8y ago
- chasedehan 8y agowow, 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 http://dadjoke.info
- tonysickpony 8y agoYour website looks sleek. Hope dad joke newsletter business goes well for you.
- chasedehan 8y agoThanks, this will probably be a net-negative on my part, but was a fun project to work on. It stemmed from a hack day I had at work
- tudelo 8y agoFYI your home page refers to "DadJokeJunkie.com promises not to spam you or share your number and you can opt out at any time." but that is not your site :P
- chasedehan 8y agoYeah, I know. Was having problems with the domain and bought the .info to just make it work. Once I have a couple minutes, I'll make it work with the other
- dibstern 8y agoUS numbers only :(
- chasedehan 8y agoI 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.
- ksahin 8y agohttps://github.com/hack4impact/flask-base 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..
- aphextron 8y agoIs there a good "zero config" application server for Flask that is considered standard now? I absolutely loved building an app with Flask but I rememeber deployment being a pain.
- cuchoi 8y agoPythonAnywhere isn't zero config, but pretty easy in my experience: https://help.pythonanywhere.com/pages/Flask/ https://help.pythonanywhere.com/pages/Flask/
- dsc_ 8y agoWe (a big newspaper - 5k-10k visitors at any time) run on Flask. Quite a big application. It was the biggest reason why I choose this job, as many python shops seem to run Django which I'm not a fan of.
- luord 8y agoAwesome news. Time to update my project templates.
- abhishekjha 8y agoThis[0] is a pretty good starting point. The organisation of modules as well as the swagger documentation provides a pretty good insight about what can be done in flask. Out of curiosity, is it possible to change a few tags in the swagger doc that one gets to see in the browser? I would like to take a few tags out. I looked it up for spring and the process was pretty daunting. [0]http://michal.karzynski.pl/blog/2016/06/19/building-beautiful-restful-apis-using-flask-swagger-ui-flask-restplus/ http://michal.karzynski.pl/blog/2016/06/19/building-beautifu...
- _eht 8y agoI can't speak to large apps, but it sure is nice for rapid prototypes. I wanted to play with the Twilio API the other day, and it make things really easy: https://github.com/e-ht/89memes https://github.com/e-ht/89memes
- cup-of-tea 8y agoPeople always talk about scaling large apps with Flask or Django, but I think that misses the point. If your app gets large enough it will inevitably start to go its own way. The point of these libraries is that lets you do a hell of a lot really quickly. I'm someone who quit web programming in around 2008 while IE6 was still a thing. I used to write PHP without a framework. As someone just getting back into it, Django and Flask or downright magical. I can do so much so quickly that would have taken days to do before. With Flask-RESTful you can turn some code into a microservice in about 10 minutes. For me, this is what makes these libraries great, not that they will fit every need of every app ever.
- akmittal 8y agoFlash was the first backend framework I really understood. It was very easy to get started with. I no longer use it but it made it so easy to learn web development.