9 ms·
One of the things that makes me sad is there is no project even remotely close comparable to Django for say Golang or Scala. I love the fact that you get an ad
by jtchang 8y ago
One of the things that makes me sad is there is no project even remotely close comparable to Django for say Golang or Scala.
I love the fact that you get an admin interface out of the box. And tons of documentation. The views/template stuff is a bit dated since everyone started moving to frontend/backend services and SPAs but we still have DRF which is incredible in the amount you get for "free".
I've had the "pleasure" of working with other large projects built on flask and ever time it gets to a certain size I wonder why we didn't just use Django. There is stuff you don't realize you need until some enterprise customer requires it for your product to even be considered. Auditing, session retries/timeouts, etc. With flask you can just add another library but it isn't as connected as Django is. And that matters a lot when you get bigger because it affects discussions about what the right way to do things is. You generally have discussions about what is the right Django way vs what is the right way in general.
- danpalmer 8y ago> One of the things that makes me sad is there is no project even remotely close comparable to Django for say Golang or Scala. Could not agree more. This is my number one reason for not moving away from Python for web stuff. > The views/template stuff is a bit dated since everyone started moving to frontend/backend services and SPAs This is certainly true for customer facing products, but for internal tools I've yet to see anything that beats the speed of development for server-side rendered basic HTML pages. 80% of the pages we have in our Django application are internal facing (we don't use the admin due to it being a poor fit for particular reasons).
- mattmanser 8y agoPersonally, as a customer, the "new" way of doing it is irritating, usually somewhat broken, slow and usually unreliable. I wouldn't be surprised if non-techies couldn't give a toss if you're using a traditional MPA with a sprinkling of ajax for the bits that really need to be responsive or a total SPA. I'm beginning to suspect the only people who want a SPA are the programmers. Has anyone even got any proof that a SPA is better than a MPA in terms of customer satisfaction? It seems to have all originated from a technical need rather than a customer need. I still prefer doing most thing server-side and then sending snippets of html to update the bits on the page that need updating, occasionally using client-side view templates/JSON, depending on the case.
- toddmorey 8y agoI think it depends on use case, of course. Gmail, Google Slides, or Figma would be poor MPAs I’d say.
- scrollaway 8y agoGood SPAs are fantastic. It's just a lot of people suck when implementing them. The Serverless documentation, an SPA, blew my mind in terms of how fast and clean it is: https://serverless.com/framework/docs/ https://serverless.com/framework/docs/
- sametmax 8y agoJust tested it on an edge connection in the German country side: Hacker news: - first load: 6 seconds - next loads: 3.5 seconds Serverless: - first load: 26 seconds - next loads: 7.5 seconds
- JoachimSchipper 8y agoReally? Randomly clicking e.g. Providers > Azure, I see a significant loading animation (the grey lines) - likely slower than just loading a simple new page each time. (Compare e.g. https://docs.python.org/3/library/weakref.html. https://docs.python.org/3/library/weakref.html.) (Single Page Applications arguably have their place. I'm just really confused why you think this is a particularly good example.)
- scrollaway 8y agoOn my awful connection, serverless is as fast as HN on new pageloads, and faster than HN when navigating to cached pages. HN is my baseline for how fast a site should be.
- OJFord 8y agoHN is typically how I determine no connection vs. crap connection.
- 8y ago
- eksemplar 8y ago> Could not agree more. This is my number one reason for not moving away from Python for web stuff. Why would you want to move away from something that works?
- StavrosK 8y agoThis is exactly my view as well. Every time I've used Flask, I ended up regretting it, because I've invariably needed to fit something to it that would have worked out of the box with Django (or at least integrated much more easily). I haven't found any reason to use Flask in a project, except maybe for small, ad-hoc scripts that you want to run in a single file.
- C14L 8y agoAnd its perfectly possible to write a one file/ten loc Django app. Everything is optional. Its just there by default, because 99% of projects will need it anyway.
- gkya 8y ago> its perfectly possible to write a one file/ten loc Django app Examples: http://olifante.blogs.com/covil/2010/04/minimal-django.html http://olifante.blogs.com/covil/2010/04/minimal-django.html https://stackoverflow.com/questions/1297873/how-do-i-write-a-single-file-django-application https://stackoverflow.com/questions/1297873/how-do-i-write-a..., and also this interesting one: https://github.com/simonw/djng https://github.com/simonw/djng where the guy builds a microframework which uses Django.
- ubernostrum 8y agoIn your last example, "the guy" is one of the people who was on the team that originally created Django, back when it was an internal tool for building a news CMS.
- macroexpanse 8y agoScala / Play Framework does in fact have an out of the box solution for this: https://www.playframework.com/documentation/1.2.2/crud https://www.playframework.com/documentation/1.2.2/crud Edit: This was removed in Play Framework 2
- roflc0ptic 8y agoThey dropped that in Play 2.x, as far as I can tell.
- macroexpanse 8y agoLooks like you're right. Comment withdrawn.
- jnbiche 8y ago> I've had the "pleasure" of working with other large projects built on flask and ever time it gets to a certain size I wonder why we didn't just use Django. Actually, I've had the exact opposite experience. I like using Django for small and mid-sized projects, because with Flask I have to spend time adding all these extra libraries for universally required functionality on a quick app whereas, with Django it's plug and go. However, the larger the project gets, the more I like Flask since I have near total control and understanding of the app. There's no digging into Django internals to make some obscure customization. Then again, it's been several years since I last used Django, so it may have changed for the better here.
- danpalmer 8y agoFor what it’s worth, on a Django codebase of 180k lines, 100k lines of templates, 1000 URLs, 380 “apps”, 350 models, we have a nice coherent structure across the whole codebase that makes us really productive. I haven’t seen a Flask code bass do this anywhere near as well. They all seem to end up becoming very different and tricky to onboard new devs onto because they are so custom. Django hides some complexity, but we haven’t found many pets we can’t effectively customise, and the architecture at scale is great, something I haven’t seen in many other places.
- travisjungroth 8y agoWhat does that Django project do?
- danpalmer 8y agohttps://www.thread.com/ https://www.thread.com/ Curated ecommerce, a CRM like system for stylist, order management, fulfilment and distribution.
- ernesto7 8y agoDo you mind explaining what that structure is? I always find the standard Django structure of everything is an "app" difficult to navigate once the codebase gets larger.
- jojo64 8y agoIndeed we are also looking for a framework to change our Django/python. We were looking at golang as half of our backend is in go but the lack of ORM make the choice impossibile. Gorm, xorm.. are not supporting Foreign Key... Yes you can write your raw SQL query but that means that your backend can't support MySQL and Postgresql (one of our prerequisites for on-premise deployment). So we are ending with phoenix. Very sad that golang doesn't provide a very good ORM.
- aidos 8y agoWhat’s the motivation for moving away from python?
- jojo64 8y agoWe are in python 2.7 and we need to migrate the application to python 3.0 For me it's another language to learn if we want to make good python 3 code. Python/Django/DRF is a stack with very poor performance if you are dealing a lot with JSON. We already have API points in golang with very good performance. No need to deal with nginx/CGI etc. nightmare. Conclusion was that our code in golang has a lower downtime. (Typed etc.) The issue is on the ability to provide code compatible with MySQL and Postgresql. Without ORM you have to duplicate your queries. So looking at a framework with ORM we are doing a benchmark of Elixir/Phoenix/Ecto. This solution could simplify our architecture a lot: websocket with room shared between server etc. Bad point is the lack of documentation on Phoenix 1.4
- thijsvandien 8y agoThe changes from Python 2.7 to 3.x are hardly so dramatic that it's like learning a new language. I'm pretty sure your performance issues can largely be addressed after proper investigation where the bottlenecks are. I do understand how nice it is to have a simpler architecture, but make sure it's worth all the work.
- jojo64 8y agoWell we can migrate to python 3 but this will be more investment in a stack that is more and more obsolete (Django) for SPA. Developers need also to learn the new best practices for python 3. At the end this will result in short term with python 3 code base written in python 2 style without the benefits of typing etc. Investment without benefits except keep our stack up-to-date. Each solution for Python/Django add complexity: - async -> celery/rabbitmq - websocket -> Channels, Daphne, asgiref, channels_redis, redid. It's quite huge to manage.
- singularity2001 8y agowhat made me sad when trying Django was that it felt not remotely close to RubyOnRails. Did I miss some ORM magic, scaffolds, generators, migrations? Did they add those in the meantime? Love the admin interface and logic though, and python>ruby IMHO
- GrigoriyMikh 8y agoWhat was the last version of Django that you used? There's build-in schema migrations since 1.7 version. Not sure what you mean by ORM magic.
- parhamn 8y ago> no project even remotely close comparable to Django for say Golang I've used Django, flask and Golang quite a bit. One thing the Golang community seems to do a good job with is building things around the http.HandlerFunc interface which in turn leads to many of the subcomponents from other OS projects fit well together through chaining handlers. For example check out the Gorilla toolkit. Django hides much of it away from you and the magic can be annoying at times. Flask seems to have failed on being both modular and nice to use for bigger projects (this is likely because WSGI isn't conducive to that sort of chaining). Basically, with go I feel like I get Flask level lightness and visibility with actual modularity -- "easy to add batteries" if you will. But I generally agree, Django is awesome. And the Django Admin is a whole beast of its own that is very unique and has been very useful for small staff alliances and management operations.
- m_sahaf 8y agoI've used neither, but Qor looks like it's of the same family: https://github.com/qor/qor https://github.com/qor/qor
- Waterluvian 8y agoYep. I just joined a company and what I could do in two months blew their minds. A lot of which was thanks to all the freebies by Django.
- nurettin 8y agoPlay! framework for Scala was pretty close to Django back in 2012, has something changed? Did they stop developing Play! ?
- currysausage 8y ago> everyone started moving to frontend/backend services and SPAs Yes, there are valid reasons for SPAs, but many web applications and most classic web sites are still better served with plain old server-generated HTML, IMO. First, because replicating even basic functionality in JavaScript comes at a cost, namely in bytes sent, bytes to be parsed, bugs introduced, etc. Second, because most projects don’t have unlimited development resources, so developers might just slap a few libraries together without necessary optimization, customization, or testing. Third, because the well-known experience of browsing static web pages is already pretty darn good, and what developers will find exciting, users might just find irritating. Needlessly breaking conventions is simply bad UX. Contrary to that, I keep reading that SPAs are the “new way”, as if classic server-rendered HTML enriched with some Ajax suddenly became a deprecated, inferior technology. It really isn’t. Unless you know what you’re doing, and why you need to, the classic way is still a sane default. If in doubt, I would always prefer a solid Django site over a half-baked SPA.