News for hackers. Stuff that matters.
Re:Removing Python 2.x support from Django for version 2.0 by Galanwe on Thursday January 19, 2017 @04:24AM (#13434327)
Interestingly, I have the exact opposite view on Django.

I hate their API and overall architecture, which I find to be the result of glueing features on top of features for many years. The internal code also is just like that: looks like every single method is riddled with out-of-band conditionals, which is the result of a community that prefers to hack things to work, instead of rethinking/refactoring.

Re:Removing Python 2.x support from Django for version 2.0 by danpalmer on Thursday January 19, 2017 @04:44AM (#13434425)
I'd prefer to hold judgement on the internals of Django, however as a developer using the API, I also think it's a pleasure to use. There is a very high level of consistency, similar patterns used throughout, and the architecture results in a project structure that I can explain to a new developer who has never used Django before in minutes. I find few frameworks really scale in terms of structure and consistency, and working on a large web application, Django has proven to be very valuable for us.

I'm curious, what's an example of a framework that you think has a better architecture, and in what context are you evaluating this?

Re:Removing Python 2.x support from Django for version 2.0 by ergo14 on Thursday January 19, 2017 @06:50AM (#13435044)
I would bet my horse on https://trypyramid.com/ when it comes to API consistency, I've updated my applications from 0.9 to 1.7 and that was a breeze. Over the years it was exceptionally great experience.
Re:Removing Python 2.x support from Django for version 2.0 by mangeletti on Thursday January 19, 2017 @09:13AM (#13435869)
I always expected Pyramid to offer some performance benefits over Django, given the origins (taking the best of framework X and Y), esp given that you can choose your own ORM (e.g., SQLAlchemy), etc.

However, once you're out of the unrealistic scenarios (single query benchmarks, etc.), it doesn't do that well[1]. It's not prohibitively slow, but to make the jump from something as well documented and with as large a community as Django, most developers would need to see major gains in one or more areas; performance, docs, community, coding efficiency, etc.

Pyramid doesn't offer these gains. It only makes promises about maintainability, which are hard to verify, unless you personally know somebody that you trust as a skilled developer, and who has worked on a sufficiently large enough project in Pyramid to make such claims... it's easy to see how this creates a hole that Pyramid has to dig itself out of.

Also, Pyramid still talks about "supporting your decisions", like Jinja2, etc., as if that's a problem people are still dealing with. Django supports Jinja2 even in the admin now, let alone being able to use whatever you want elsewhere. As a side note, I don't see many Python developers wanting to use anything other than Django templates (for simplicity and separation of concerns) or Jinja2 (for speed and flexibility) these days.

If the argument, in response to the aforementioned difficulty in verifying claims about maintainability, is "well, it's up to you; Pyramid stays out of the way", then the immediate response is that you're better off using Flask or Falcon; the former if you need third-party tools, and the latter if you need maximum raw speed, but still want Python. Both of those frameworks will drastically outperform Pyramid and stay out of your way.

IOW, I don't think Pyramid fills any reasonably sized and easily understood market gap.

1. https://www.techempower.com/benchmarks/#section=data-r13&hw=...

Re:Removing Python 2.x support from Django for version 2.0 by SEJeff on Thursday January 19, 2017 @10:54AM (#13436724)
Flask was an April fools joke from Armin that became a serious thing. The thread locals hacks and use of globals is pretty horrible. I do quite like Falcon however if I want something != Django.

http://lucumr.pocoo.org/2010/4/3/april-1st-post-mortem/

http://mitsuhiko.pocoo.org/flask-pycon-2011.pdf

Re:Removing Python 2.x support from Django for version 2.0 by oneweekwonder on Friday January 20, 2017 @02:36AM (#13442268)
What is your opinion of bottle.py?
Re:Removing Python 2.x support from Django for version 2.0 by cookiecaper on Thursday January 19, 2017 @11:47AM (#13437198)
I used Pyramid for a couple of large projects back when it was Pylons, and around the time of the merger that resulted in Pyramid.

Django has grown up a lot in the last several years. It used to be really hard to use a different templating language, and I personally really dislike Django's templating language. That was the biggest turn off for me every time I looked into Django. If it had been pluggable earlier, this probably would've changed the calculation for me.

I've always thought of Pyramid as the ideal framework, conceptually. It feels like you're writing Python, not Pyramid, which is GREAT. Pyramid only shows up when you say "OK, I have my Python stuff; I need to make this show up in the web browser now." It is entirely unobtrusive. All frameworks should strive for that.

Unfortunately, the vast majority of frameworks take the opposite approach. Django at least used to be an example of that by forcing DTL (is this the abbreviation for "Django Templating Language"?) down everyone's throat, among other things.

I've also been very impressed by Chris McDonough and the rest of the Pyramid team. They're extremely helpful in IRC, they keep up the great work even after spending years as a small/niche framework, and their code is very clean and well-tested, not obnoxious or overcomplicated. It's a tight, consistent framework that stays out of the way and is just there to serve the developer, not to force him/her to comply. It is so everything a framework should be and so everything most frameworks aren't that I can't help but love it.

I haven't done a major Python-based web project for many years (have one in progress, porting a Rails-based site to a Mezzanine-based site, but work on it only rarely), so I'm sure some of this is outdated.

Re:Removing Python 2.x support from Django for version 2.0 by mangeletti on Thursday January 19, 2017 @12:03PM (#13437307)
Thanks for the reply.

What makes Pyramid better for you than e.g., Falcon?

From your comment, it sounds like a lot of the value you've gleaned from Pyramid is based on the framework staying out of your way, so why not use something 5x faster that does the same thing? Does Pyramid provide some unmatched abstractions? (I'm coming from a position of no true experience in Pyramid)

Re:Removing Python 2.x support from Django for version 2.0 by cookiecaper on Thursday January 19, 2017 @12:06PM (#13437331)
As far as I know Falcon didn't exist last time I seriously looked into Python frameworks, so I don't know what would make it better or worse. From a quick glance, it looks promising and I'll definitely want to evaluate it next time I seriously engage in a custom Python web application, though I don't expect to do so for a long time (current project depends on the also-superb Mezzanine, a Django-based CMS).
Re:Removing Python 2.x support from Django for version 2.0 by ergo14 on Friday January 20, 2017 @10:06AM (#13444287)
Yes, there isn't feature parity between pyramid and falcon.

You have event system, security abstraction, all kinds of overloading helpers for views and internal machinery that falcon doesn't seem to provide at least from my cursory look. Compare the size of documentation and configuration options between both projects.

Also looking at this http://klen.github.io/py-frameworks-bench/ the 5x better speed of falcon seems to be completly made up or occur in some very specific situation. More realisticly it looks like falcon can be 30% faster in some scenarios not involving storage - but for the price of giving you less options.

Which probably means that if you use any kind of storage the difference between those two can be ignored.

Re:Removing Python 2.x support from Django for version 2.0 by sirn on Thursday January 19, 2017 @12:03PM (#13437314)
Pyramid is actually more of repoze.bfg[1] which inherited a little bit from Zope. The overall experience is still very Pylons-like, and Zope stuff are very transparent, though.

[1]: http://docs.repoze.org/

Re:Removing Python 2.x support from Django for version 2.0 by sirn on Thursday January 19, 2017 @11:20AM (#13436933)
> However, once you're out of the unrealistic scenarios (single query benchmarks, etc.), it doesn't do that well[1].

I'm curious about the result since it didn't matched my experience. So I proceed to take a look at the source code for both Pyramid's[1] and Django's[2] benchmarks. From the look of it, I feel like there are too much difference in implementation to call this a realistic comparison.

From a quick glance, Django's benchmark seems to contain a little bit of micro-optimization and is rendering JSON response directly with uJSON[3] (which looks to be a lot faster than native JSON module)[4], while Pyramid's benchmark did not seems to go through any optimizations and is returning a list of SQLAlchemy objects that get passed into a custom renderer[5]¹ and render using native JSON module.

So I don't think it's entirely fair to say Pyramid is slow in a real world scenario based on this benchmark alone.

[1]: https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a5...

[2]: https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a5...

[3]: https://pypi.python.org/pypi/ujson

[4]: http://artem.krylysov.com/blog/2015/09/29/benchmark-python-j...

[5]: https://github.com/TechEmpower/FrameworkBenchmarks/blob/c8a5...

¹ Using pyramid.renderers.JSON here probably make more sense, but to match Django's implementation, one can wrap a serialized JSON into `Response` object.

Re:Removing Python 2.x support from Django for version 2.0 by linsomniac on Thursday January 19, 2017 @11:02AM (#13436788)
I've been talking to some of the developers on FreeNode about their support of old releases. In particular, related to statements about "Once 1.8 comes out, 1.6 will no longer receive patches". 1.7 came out 9 months ago and 1.8 is in beta. In other words, they don't really have a LTS process.

And the developers seem to think this is totally ok.

In my experience, anything that doesn't have a commitment to at least fixing security issues for ~5 years, isn't a good choice for business. Businesses don't want to tie their internal development and release cadence to an external development team with less than 3 year cycles, ideally 5+.

I've seen it time and again over dozens of companies. There is no time to qualify apps for new major/minor releases. Anything that doesn't have a LTS release story is just not something I can feel good about deploying in my business.

Re:Removing Python 2.x support from Django for version 2.0 by mmerickel on Thursday January 19, 2017 @11:47AM (#13437199)
> And the developers seem to think this is totally ok.

To be clear the core maintainer-ship of pyramid is about 2-3 people. We would love more contributors to the core codebase, but with that level of commitment we're obviously not able to provide a comparable level of support to a project with more contributors. This is the nature of open source and it is the rare exception to the rule to find packages / projects that have grown to be able to offer such a level of support.

Re:Removing Python 2.x support from Django for version 2.0 by linsomniac on Thursday January 19, 2017 @12:47PM (#13437686)
Sure, but this is in a thread that starts with "Django has a new release", so I do think it is relevant considering that Django DOES have LTS releases.

(Aside: mmerickel is the developer I was talking to in Freenode)

Honestly, I didn't know that Pyramid had such a small amount of manpower behind it. It presents itself and has a reputation in the Python community, at least in my experience, of a bigger project.

But, as far as not being able to commit to security releases for old versions: it's obviously a choice in where to spend the available resources, not one of the size of those resources. Choosing new development over providing critical fixes of older releases is a choice, it's just one I need to understand before I commit to using a component. I understand why one would make either of those choices, I just need to know which one has been selected. It is great for people who want to choose forward development focus, I'm just not one of them.

Re:Removing Python 2.x support from Django for version 2.0 by misterhtmlcss on Thursday January 19, 2017 @01:19PM (#13438014)
While I'd say that's true as a general rule, an aging system requires a disproportionate amount of time as it ages and the diversity of the platforms underlying stack changes and evolves. This is an issue that would grow exponentially worse over time and being as their team is that small they need to consider risk to their user base when choosing the longevity of their product support. It's quite possible they could support normal issues up to 5 years, but what about the '20 year flood scenario' or 'once in a lifetime flood' if you prefer? What if something that level of bad hits near the 5 year mark and the platform diversity is nearing its maximum diversity?

I believe it's better for them to focus on what they know they can do day in and day out regardless of the circumstances and let companies make the decisions that make sense to them.

In a world where the hardware is written off by the business in 3 years though and websites age out at 3 years and car manufacturers are increasingly trying to hit a 3 year model revision mark it seems to me it's not too much to ask that companies investing hundreds of thousands in an application using Django or Pyramid also invest in maintaining it and keeping it modern or perhaps their existing business model needs additional revision too.

Just a thought as the least informed member of HN.

Re:Removing Python 2.x support from Django for version 2.0 by ergo14 on Thursday January 19, 2017 @06:18PM (#13440371)
But you think about this in a wrong way - pyramid is a "glue" framework, unlike django.

- request/response (webob) gets its own updates.

- templates get their own updates.

- sqlalchemy gets its own updates Etc.

You WILL get security fixes for most of your application even without upgrading the framework itself (the attack surface for pylons/pyramid itself is smaller than monolith).

By being on a lower version you don't really miss much - the API's are very stable. And 99% of time you can update pyramid version itself without risking application breakage (the chance of it is probably a lot lower than with monolithic framework).

I know about very heavy websites that are still using pylons(precursor to pyramid) in production without issues (8 years now).

Re:Removing Python 2.x support from Django for version 2.0 by linsomniac on Thursday January 19, 2017 @09:14PM (#13441255)
... then isn't it not a big deal to commit to security updates?
Re:Removing Python 2.x support from Django for version 2.0 by ergo14 on Friday January 20, 2017 @04:18AM (#13442553)
Sure, as far as i can tell it was always being updated so far - even without written commitment.
Re:Removing Python 2.x support from Django for version 2.0 by tangue on Thursday January 19, 2017 @07:15AM (#13435161)
Pyramid is great, but for years they had a ridiculous Iron Maiden- heavy metal like branding [0] which make it hard to sell it in the corporate world. I'm glad they evolved on this point.

[0] http://keitheis.github.io/use-pyramid-like-a-pro/?full#Cover

Re:Removing Python 2.x support from Django for version 2.0 by vog on Thursday January 19, 2017 @08:16AM (#13435493)
I don't mind the artwork (and actually like it), but I think the real issue is the text:

    Use Pyrapid Like a Pro
"Like a pro(fessional)" implies that you, the target audience, are not "professionals". However, if you use it in the corporate world, you do use it as a professional.

This makes it sound like an advanced toy rather than a bullet-proof work of engineering you can rely on. Which is really a pity, because Pyramid _is_ a framework you can rely on.

Re:Removing Python 2.x support from Django for version 2.0 by dkns on Thursday January 19, 2017 @08:06AM (#13435433)
Not gonna lie, that cover(?)/artwork(?) looks pretty sweet. But I'm probably biased because I really like Iron Maiden.
Re:Removing Python 2.x support from Django for version 2.0 by mangeletti on Thursday January 19, 2017 @08:32AM (#13435590)
I agree, but you know what; I think the new branding is worse :(

It's a shame, because I've wanted to try Pyramid since I watched their talk at PyCon 2011, but the branding (including the new 99 Designs looking logo / theme) has always made me think, "This will never really take off."

Re:Removing Python 2.x support from Django for version 2.0 by bpicolo on Thursday January 19, 2017 @08:45AM (#13435678)
Not to mention, a few parts / typical components of pyramid are kind of nuts, like auth. Colander is also a struggle to use.

Still my go-to framework though. The websauna framework linked above might be something I have to try.

As I build more and more side projects I find myself wishing pyramid were just a bit more opinionated so I could get the basics up and running a tad faster. At this point I mostly cut up old projects and port them to each next one, heh

Re:Removing Python 2.x support from Django for version 2.0 by Yuioup on Thursday January 19, 2017 @09:00AM (#13435772)
One of the off-putting remarks I get is, "what is this, a pyramid scheme?". I don't like the name, they should have stuck with Pylons.
Re:Removing Python 2.x support from Django for version 2.0 by smnscu on Thursday January 19, 2017 @09:06AM (#13435815)
If like me you really liked the slides, this is the framework/engine https://github.com/shower/shower

The theme is one of the included ones, Ribbon.

Re:Removing Python 2.x support from Django for version 2.0 by danpalmer on Thursday January 19, 2017 @12:04PM (#13437317)
My problem with Pyramid (although having never used it in production) is the same as my problem with Flask.

They say "Start small, finish big", and push the fact that Pyramid scales from a single file codebase, up to many files. This is something that I just haven't seen in practice.

A Django project requires quite a few files, so it's never a great answer when the total amount of business logic is <100, or maybe even <1000 lines of code. However, a 10k line Django site and a 100k line Django site basically look the same in my experience, and that is hugely valuable.

The biggest red flag from Pyramid for me is their point: "Use Pyramid as a "framework framework" to craft your own special-purpose, domain-specific web system".

In my experience, this means that every project is a special snowflake of a project that works in a very different way to other projects. With Django you have a tried and tested architecture, with Flask and Pyramid, it often seems that you have to create your own architecture in some ways, and that results in each project being really quite different.

Re:Removing Python 2.x support from Django for version 2.0 by ergo14 on Thursday January 19, 2017 @06:25PM (#13440408)
Well, for what its worth 1.7 ships with new default scaffolds that that have better separation between models,views and templates - and now is a very decent starting point with everything preconfigured for you (certainly much better than starting with flask from scratch in my opinion if you are not really experienced). You do not start with a single file codebase anymore - if you have a moment try it again you might like it.
Re:Removing Python 2.x support from Django for version 2.0 by bradmwalker on Thursday January 19, 2017 @08:37AM (#13435624)
WebSauna looks promising: https://websauna.org/docs/narrative/background/intro.html

Offers Django feature parity with best of breed components.

Re:Removing Python 2.x support from Django for version 2.0 by miohtama on Friday January 20, 2017 @04:32AM (#13442594)
You'll get Django parity with Pyramid modern design patterns.

If you have any questions please pop into the chat http://gitter.im/websauna/websauna

Re:Removing Python 2.x support from Django for version 2.0 by creshal on Thursday January 19, 2017 @05:05AM (#13434538)
Minutes is a bit of an understatement, but given the amount of complexity involved, the API is acceptably consistent.
Re:Removing Python 2.x support from Django for version 2.0 by raverbashing on Thursday January 19, 2017 @05:06AM (#13434540)
> instead of rethinking/refactoring.

And breaking backwards compatibility

Django is not RoR. Their users rely on being able to upgrade seamlessly.

The overall Api makes sense, there are some rough corners (yes Sites, I'm talking about you) the docs are ok once you get the hang of them

Re:Removing Python 2.x support from Django for version 2.0 by surouaue on Thursday January 19, 2017 @05:43AM (#13434713)
When you say "Django is not RoR", are you saying Django doesn't break backwards compatibility but Ruby on Rails does?

If so, I have to very strongly disagree. It's almost mind boggling to me how much they break backwards compatibility as a framework. They usually warn users with a deprecation warning in one version and then they make the backwards incompatible change in the next version, but the sheer amount of these kind of changes makes upgrading an infuriating process. Especially when upgrading a large codebase.

Re:Removing Python 2.x support from Django for version 2.0 by etatoby on Thursday January 19, 2017 @06:02AM (#13434801)
> warn users with a deprecation warning in one version and then they make the backwards incompatible change in the next version

That's exactly how _not_ to break backwards compatibility.

Re:Removing Python 2.x support from Django for version 2.0 by zmb_ on Thursday January 19, 2017 @07:45AM (#13435292)
That is, by definition, breaking backwards compatibility. I.e., the code that I wrote against version X will not run against version X + n. They just give a warning about it in version X + (n - 1). Backwards compatibility means that my code will run against X + n for all values of n >= 0 without modifications.
Re:Removing Python 2.x support from Django for version 2.0 by Sean1708 on Thursday January 19, 2017 @09:54AM (#13436215)
How should you break backwards compatibility then? This is about as good a solution I can come up with.
Re:Removing Python 2.x support from Django for version 2.0 by stefantalpalaru on Thursday January 19, 2017 @07:08AM (#13435119)
> That's exactly how _not_ to break backwards compatibility.

No, no, no. Backwards compatibility means that there are no breaking changes at all - announced by deprecation warnings or not. Think Linux's public API.

Re:Removing Python 2.x support from Django for version 2.0 by raverbashing on Thursday January 19, 2017 @06:03AM (#13434804)
Oh they do break, but it's a much slower process than RoR (as you described)

IIRC the most impacting changes I remember were in Config, replacement of South with a native solution and some timezone issues

Re:Removing Python 2.x support from Django for version 2.0 by Animux on Thursday January 19, 2017 @02:17PM (#13438625)
The upgrade process of south was pretty shitty.

The documentation was telling something like: Ensure you applied all previous migrations and then start from scratch. Thats not an upgrade path. It may work for standalone web applications, but I have a python project (packaged as deb/rpm package and using the packaged django version of different distributions) that should work with multiple django versions and the user may upgrade the django version at any point.

I had to write raw sql statements to get the mirgration status of south (after the upgrade, without a working version of south anymore) and "fake" apply the migrations of the new native solution.

Re:Removing Python 2.x support from Django for version 2.0 by ubernostrum on Thursday January 19, 2017 @03:06PM (#13439031)
If you were supporting applications which needed to work with or without South at the time of the transition, the best thing to do was probably ship two separate sets of migrations (one set written for South, one written for Django's built-in migration framework).
Re:Removing Python 2.x support from Django for version 2.0 by Animux on Thursday January 19, 2017 @06:03PM (#13440285)
Yes, that's what I am doing. The problem is, how to preserve the state of the migrations when the user updates the django version.
Re:Removing Python 2.x support from Django for version 2.0 by lucaswiman on Thursday January 19, 2017 @03:06PM (#13439035)
I've upgraded a large (~700K LOC) Django project across several versions (1.5-1.9). I think Django does a reasonably good job of maintaining a good upgrade path, though they frequently break backwards compatibility, and at a pretty fast rate (now 8 months release cycles, which barely gives the community to catch up). Some of the changes like module renames seem pointless from an end user perspective, so it feels like the django core team shovels busywork onto users. I also find their method naming policies annoying, since they don't annotate "unsupported" features in any way (eg with an _attribute, and also some _attributes ARE supported). This makes it difficult to figure out whether you're "staying within the lines" of their support policy. I keep a checkout of the django repo around so I can grep the docs for mentions of a method before I use it.

That said, having started on updating that same codebase to Python 3, the Django team tries hard to provide the KEY thing you need to seamlessly update a codebase: a version which can support both incompatible features. Without this, you need to have one giant branch with a bunch of renames and other changes. They actually introduce deprecation warnings, and have something non-deprecated you can use in the same version. I think if Python core had introduced a version of Python including both versions of all the module renames with deprecation warnings, the community would be much further along on the upgrade path.

Re:Removing Python 2.x support from Django for version 2.0 by Flip-per on Thursday January 19, 2017 @06:44AM (#13435010)
How else would you introduce backwards incompatible changes? Especially with the LTS upgrade path that alasdairnicol mentioned I wonder what there is still to improve.
Re:Removing Python 2.x support from Django for version 2.0 by PeterisP on Thursday January 19, 2017 @08:18AM (#13435501)
If you want to be backwards compatible, then you "simply" do not introduce such changes, there's no "how", you don't.

A platform that works hard to be backwards compatible does only additions and extensions, and keeps maintaining the old API as well so that old apps run without changes; possibly keeping around multiple depreciated ways to do the same thing (e.g. as win32 does).

It is debatable whether backwards compatibility is worth that cost (and it often isn't), but it's certainly a choice.

Re:Removing Python 2.x support from Django for version 2.0 by imtringued on Thursday January 19, 2017 @09:24AM (#13435953)
Mark it as deprecated, change the documentation to tell the user to use the new function Y instead and the most important part: keep the old api even if it's crufty. Wait for a few years until everyone upgraded and no longer uses any deprecated functions. Maybe make a final LTS release for those who don't want to upgrade. Then and only then should you ever break backwards compatibility.
Re:Removing Python 2.x support from Django for version 2.0 by ubernostrum on Thursday January 19, 2017 @03:08PM (#13439044)
Wait for a few years until everyone upgraded and no longer uses any deprecated functions.

Then view HN threads of people saying they have thirty-million-line codebases which utterly rely on deprecated functionality and they never ever plan to upgrade or do even basic maintenance ever for any reason ever, and will abandon your platform and completely rewrite in something that treats them "better".

Re:Removing Python 2.x support from Django for version 2.0 by lanstin on Thursday January 19, 2017 @07:29PM (#13440771)
I worked in a C shop for like 8 or 10 years and we never introduced a back-wards incompatible API release. There were a few changes that required all servers to be restarted (not at once) to change network protocol (16-bit fields overflowing, that sort of thing). But it was inconceivable that you'd break something that is working. To be sure, we took a couple of weeks before designing an API, and for no one was the API they wrote and shared with others the first API they designed as an adult. Even when the implementation mutated out of all recognition, the API owner would just do whatever re-coding/re-implementation was needed behind the existing API.
Re:Removing Python 2.x support from Django for version 2.0 by stefantalpalaru on Thursday January 19, 2017 @10:15AM (#13436377)
> How else would you introduce backwards incompatible changes?

Not at all. That would have the added benefit of core developers thinking twice before introducing a new API - exactly like it happens with Linux syscalls.

Re:Removing Python 2.x support from Django for version 2.0 by metaphorm on Thursday January 19, 2017 @11:02AM (#13436786)
breaking changes get a 2 major version release timeline. that's like 18 months (on average) of warning to update your shit. how could you possibly do this better?
Re:Removing Python 2.x support from Django for version 2.0 by BozeWolf on Thursday January 19, 2017 @05:59AM (#13434786)
If you keep up with releases it usually is quite alright. Switching LTS versions causes a lot of drama indeed. But that is to be expected.
Re:Removing Python 2.x support from Django for version 2.0 by alasdairnicol on Thursday January 19, 2017 @06:33AM (#13434950)
Agreed 1.4 LTS to 1.8 LTS was tricky, but future LTS to LTS upgrades like 1.8 to 1.11 should be easier. From 1.8 onwards, if your code runs without depreciation warnings in one LTS, then it should work on the next.
Re:Removing Python 2.x support from Django for version 2.0 by metaphorm on Thursday January 19, 2017 @11:01AM (#13436773)
> there are some rough corners

content_types, generic foreign keys, and basically any other uncommon use pattern for RDBMS are very rough in django. Tradeoff of their ORM being heavily streamlined for the 90% use cases (typical SQL selects and upserts).

Re:Removing Python 2.x support from Django for version 2.0 by rbistolfi on Thursday January 19, 2017 @11:11AM (#13436857)
But you can use other ORM if you want, or no ORM. However, the benefits of using Django come mostly from using their highly integrated components, I admit. In any case, we swapped the ORM with our own implementation of the data layer and we are doing fine. I like the API overall, specially class based views.
Re:Removing Python 2.x support from Django for version 2.0 by raverbashing on Thursday January 19, 2017 @11:16AM (#13436890)
Yes

Might be easier to just write SQL in those cases

Re:Removing Python 2.x support from Django for version 2.0 by nsomaru on Thursday January 19, 2017 @04:43AM (#13434407)
Could you give a description of some subsystem that has been architectured in this way, and then provide a concrete example of some methods that implement this pattern and why it is bad?

We are users of Django, and it helps us to deliver projects, quickly. Interested to know how you think things could be improved.

Re:Removing Python 2.x support from Django for version 2.0 by scrollaway on Thursday January 19, 2017 @05:36AM (#13434676)
I disagree with the parent post; Django's codebase is overall pretty high quality. It definitely used not to be that way, though.

But there are components that fit that. The entire form subsystem is awful to work with. Working with Javascript, webpack apps etc is a huge pain.

The template syntax is also a failed design experiment, based on the premise that backend coders and template authors are not the same people and should not have the same level of power -- some of this is based on a good idea at its core, but Django ended up backtracking on that half-way and we're now with a very inconsistent template system and having to implement kludgy template tags and filters or new object methods that do not take parameters whenever we want to do anything remotely complex.. At this point I wish it'd just move towards supporting Jinja syntax (that is, alongside the regular syntax, not as a separate engine like it's currently possible).

Re:Removing Python 2.x support from Django for version 2.0 by metaphorm on Thursday January 19, 2017 @11:06AM (#13436811)
I think the form abstraction is one of the better versions of it that I've seen in any of the web frameworks I've worked with. It's simple and elegant for most forms, and can even handle complicated ones (multipart forms, file attachments, complex validation scenarios, etc.) reasonably well.

on a really fundamental level working with complicated forms is just a complicated thing to do, no matter what kind of technology you're doing it with.

Re:Removing Python 2.x support from Django for version 2.0 by wahnfrieden on Thursday January 19, 2017 @09:22AM (#13435940)
Django added Jinja2 as a built-in template backend some versions ago. The Django ecosystem hasn't really caught up to supporting it with reusable templates yet though.
Re:Removing Python 2.x support from Django for version 2.0 by scrollaway on Thursday January 19, 2017 @09:43AM (#13436125)
Yeah I mentioned that. I don't think it can ever really work the way it's implemented right now. I think the only way it can work is slowly transitioning the Django template language to be syntactically similar to Jinja, that will give a progressive transition path. But it's a ton of work.
Re:Removing Python 2.x support from Django for version 2.0 by acdha on Thursday January 19, 2017 @09:13AM (#13435867)
> Working with Javascript, webpack apps etc is a huge pain.

Could you explain what you mean? Django doesn't need to have any connection at all to your JavaScript stack.

Re:Removing Python 2.x support from Django for version 2.0 by scrollaway on Thursday January 19, 2017 @09:22AM (#13435938)
If you want to use the Django staticfiles system (which you do - it's good and useful for non-js stuff as well), it kinda does.

We use Django Webpack Loader for our sites: https://github.com/owais/django-webpack-loader - This allows us to do `{% render_bundle ... %} which pulls in the appropriate script tag.

But even then you can really feel how painful it is to work with, especially if you're adding typescript/scss to the mix. Solutions like Django Compressor are not really the right model anymore.

And there's other issues as well. If you want to share settings between Django and the JS stack for example, you'll need to build your own pipeline for that. Building a form in react? Say goodbye to DRY on the form fields. Just, in general, Django predates JS apps being anything more than in-place enhancements and it shows.

Re:Removing Python 2.x support from Django for version 2.0 by Daishiman on Thursday January 19, 2017 @11:44AM (#13437168)
If you're building a form in React why do you even bother with django forms when there's Django Rest Framework?
Re:Removing Python 2.x support from Django for version 2.0 by scrollaway on Thursday January 19, 2017 @01:43PM (#13438295)
I do use DRF; but it's quite painful to have to set up all the intermingling between the API urls and the actual form definitions. I don't use Django forms; you will generally want a single source of truth for the forms and it kind of has to live in the JS, but then that makes it inaccessible to Django...

For large apps it makes sense to do it this way. For smaller apps it really sucks.

Re:Removing Python 2.x support from Django for version 2.0 by olau on Thursday January 19, 2017 @11:15AM (#13436882)
The template system is sometimes a pain, but sometimes the fact that it pushes you to move complexity out of the HTML and into Python code can make for more maintainable code in the long run. That's at least been my experience over the years.
Re:Removing Python 2.x support from Django for version 2.0 by rectangletangle on Thursday January 19, 2017 @01:10PM (#13437919)
It's annoying at first, but if you maintain a code base long enough, you'll be glad it's done the way it is.

This also has the side-effect of making the transition to client-side templating easier.

Re:Removing Python 2.x support from Django for version 2.0 by stuaxo on Thursday January 19, 2017 @04:46AM (#13434437)
Not sure what it's like now, but the insides of the admin used to be fairly terrible (generating HTML with strings for instance).

There was a patch to change this to use templates, but it was rejected at the time as it slowed things down too much.

FormWizard (which I hear doesn't exist now), was a nightmare to use for any sort of complex form - I tried to do just this and had to call many private methods.

I understand metaclasses, but found the implementation of the ORM a little overcomplex.

Trying to use the ORM API to work out the structure of the DB was a bit of a pain last time I tried (had to call private APIs).

Re:Removing Python 2.x support from Django for version 2.0 by samwillis on Thursday January 19, 2017 @05:00AM (#13434516)
The core Django developers will (and have) freely admit that the admin interface implementation is a bit of a mess. There is an enormous amount of technical debt in it. It is however not a "core" part of Django and there are many alternatives. I think most people would agree that the correct long term solution to the admin interface is a complete rewrite, however the cost of doing so is too high.

The html forms (used in the admin and everywhere else) have until now been generated from strings, however the next realise 1.11 (went to alpha yesterday) this has been changed to using the template tools.

Re:Removing Python 2.x support from Django for version 2.0 by throwawayish on Thursday January 19, 2017 @05:32AM (#13434656)
While the admin code is kinda messy it's still easy to extend and customize. I'd be somewhat surprised if you could make something that dynamic and not be at least a bit messy.

I myself and also other people I know have written quite some domain-specific applications almost entirely within the Django admin, which are as a result: secure, fast and easy to use, which in some cases are not just a bit better than the existing commercial tooling in these domains.

Re:Removing Python 2.x support from Django for version 2.0 by ankitml on Thursday January 19, 2017 @05:04AM (#13434530)
Not sure why you hate it? It is one thing to say Django is bad at x and then specify x and other thing is to say I hate Django because it its internals are shit and shoot your points like a machine gun. The second approach is not going to be helpful to anyone.
Re:Removing Python 2.x support from Django for version 2.0 by sly010 on Thursday January 19, 2017 @12:38PM (#13437601)
I honestly think Django was a victim of it's own success. It started as a python (explicit is better than implicit) framework, but with a ruby-on-rails (convention over configuration) mentality. It became too successful too fast and it was too late to change things without breaking things. I remember it had all sorts of double import issues, a very limited (compared to jinja2) template engine and a very limited (compared to SQL Alchemy) ORM. It also coupled everything with everything, so it made it very hard to fix those issues. So as people grew into their projects, django got in the way. Most things were hidden in the framework lazily loaded so when you had some weird issues you didn't know where to look. I found it hard to digest that I couln't write a simple script that accesses the database without having to go through the entire autodiscovery process, hence incurring a 2-3 second delay on every execution. We also stopped upgrading at some point, because by the time django started supporting our special needs (especially around user handling), we already hacked around it, and upgrading would have been near impossible. The core developers probably knew all of these and they did more and more "de-magic-ification" with every version, and things are much better now, but we are stuck on an old version.
Re:Removing Python 2.x support from Django for version 2.0 by metaphorm on Thursday January 19, 2017 @10:56AM (#13436736)
In my opinion the user (where user is a web developer) facing layer of Django is among the best I've ever worked with. I will agree with you that the internals are very messy and hard to read and work with.

The overall architecture is sound though. Tight coupling of core components, loose coupling of non-core components. Keep in mind that it's an "opinionated" framework though, so they do safely assume that if you're using django you want to be using its core components as a bundle, and will work with them as designed.

Re:Removing Python 2.x support from Django for version 2.0 by yeukhon on Thursday January 19, 2017 @09:34AM (#13436039)
I'd say if you hate it, you should propose the changes and how to refactor. There's only so much people can do and they certainly will benefit from first-time contributors who may have fresh ideas. Otherwise this is just plain complain and nothing else.
Re:Removing Python 2.x support from Django for version 2.0 by stuaxo on Thursday January 19, 2017 @04:43AM (#13434408)
Last time I looked a lot of the insides were terrible.

A project I was really impressed with the internals of is Celery (was expecting the worst having seen Django).

Re:Removing Python 2.x support from Django for version 2.0 by Ralfp on Thursday January 19, 2017 @05:19AM (#13434600)
> Last time I looked a lot of the insides were terrible.

But is it really? Speaking from personal experience it is easy to compare project with large featureset (and one with heritage) to one with scope on doing single thing and come with conclusion that smaller, focused codebase is more consistent and better implemented. At the end of day what matters is if those terriblenesses actually bite back:

- is this code changed frequently? Does it need to be changed frequently? - is it written in a way that that makes fixes and improvement unbearably costful? - is it written in way that allows it to be put apart? How costful are those individual parts to improve?

Django is large codebase that is worked on by different people and when time permits this, which means different parts differ in their age, practices, and ultimately, quiality. This eventually results in codebase that may give appearance of being messy.

Joel Spolsky explains this nicely in his article about old and large codebases appearing as hairy and messy to developers:

https://www.joelonsoftware.com/2000/04/06/things-you-should-...

Especially the part that follows below quote is valuable wisdom to keep in mind:

> When programmers say that their code is a holy mess (as they always do), there are three kinds of things that are wrong with it.

Re:Removing Python 2.x support from Django for version 2.0 by jbkkd on Thursday January 19, 2017 @05:32AM (#13434653)
Celery is an interesting one. The code looks well written, but I found contributing to be a real pain and documentation a mess, especially compared to Django's docs.

Also, up until recently it was a one man job by Ask Solem. He's done incredible work making this project live and I am grateful for that. However I fear others have found it hard to maintain as well, slowing down progress on a very popular backend python project.

Re:Removing Python 2.x support from Django for version 2.0 by gtaylor on Thursday January 19, 2017 @04:46AM (#13434438)
Things were a little bit hairy back in the 1.3 days, but they've done a ton of cleanup in modern times. I find the source much easier to follow these days. Many of the systems have been more clearly isolated to allow for replacement.
Re:Removing Python 2.x support from Django for version 2.0 by daenney on Thursday January 19, 2017 @05:12AM (#13434574)
When was the last time you looked?