6 ms·
I have tried to be happy with django, I really have.
- newsisan 16y agoIs it really that bad? I get the impression that most are happy with Django (or maybe that is other python frameworks.....).
- endlessvoid94 16y agoIt's not really that bad. I'm baffled how he could spend 2 years with Django and not understand how to do the things he's complaining about (not to mention python). I think it was just a bitching session.
- edanm 16y agoThe OP makes a few points, most of which I disagree with (they're mostly a matter of opinion). One valid point he makes is: "Confusion on where to put code, and too much flexibility". Can't say how it is in other frameworks, having never used them, but The Django Book had far too many cases of saying "you can do it here or there, it's a personal preference". I don't want to make a choice when I'm new to a framework, I want to be told what's correct and what isn't!
- tialys 16y agoI think it's a matter of what kind of framework you want to be. Rails is very opinionated: Fat model, skinny controller, and use helpers or you're a fool. Django is less so: Put it here, or there... whatever you like. It really comes down to the philosophy of the underlying language I think. Ruby in general is kind of opinionated, and python less so.
- epochwolf 16y agoPython is quite opinionated. http://www.python.org/dev/peps/pep-0020/ http://www.python.org/dev/peps/pep-0020/
- edanm 16y agoOne of Python's doctrines is "There is only one correct way to do things", which suits my philosophy perfectly: I don't like having to make decisions, I like it being obvious what the correct way of doing things is. That's why Django's "flexible" approach seems odd to me.
- deleted 16y ago[deleted]
- anthonyb 16y agoAnother one of Python's doctrines is that practicality beats purity. Given the differences between a lot of websites, I can see a one-size-fits-all model going out of the window pretty quickly. Especially so given all of the wa-wa-I don't like the auth/admin/predefined data fields that seems to be going on here...
- demallien 16y agoI would have said exactly the opposite - Python is opinionated ("only one way to do it"), whilst Ruby is far more perlesque in it's "anything goes" philosophy.
- draegtun 16y agoYep Ruby is definitely more TMTOWTDI (http://en.wikipedia.org/wiki/Theres_more_than_one_way_to_do_it http://en.wikipedia.org/wiki/Theres_more_than_one_way_to_do_...) whereas Python is antithetical to this.
- anthonyb 16y agoIt's impossible to say, because at no point in his rant does he give any concrete detail on what exactly he was trying to do. I've never had any issues knowing where to put code in Django, or in reading its source code.
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- yourkin 16y agoIt is confusing only at first glance. Django unambiguously states where to put your models, view functions, forms and the url patterns. Those are grouped into an 'application', which you can have many and define logically by the general task you want them to solve. Inside the model, view, form and url files (settings too for that matter) you write your code according to the style and philosophy of Python. For that reason Django can not and must not define for you in what other file should you keep and what name should you assign to some class you write that is required for one of your views or another. If you don't feel comfortable with the structure of your Django code, it's best to look into general good practices of Python programming, because Django is Python!
- jerf 16y agoIIRC, the way it works is that Django specifies where in the package namespace it expects things. But you can always load anything into that package namespace. If you have a file specifying models, you can either: class SomeModel(...): ... class SomeOtherModel(...): ... or from some.other.place import SomeModel from yet.another.place import SomeOtherModel and it's the same. Django is Python. In fact this is another instance of what I complained about yesterday: http://news.ycombinator.com/item?id=1605928 http://news.ycombinator.com/item?id=1605928 People see the "DSL" and all knowledge of the underlying language goes flying out the window. Models are actually very, very non-magical, and anything that you do that ends up with class in the certain namespace simply is a model, and any Python language feature that lets you produces such a class can be used to make one.
- steveklabnik 16y agoThis would be the same thing as Rails... yeah, it'll load everything in app/models by itself, but anything else is just a require away.
- ntoshev 16y agoI'm the opposite, e.g. I find Django templates too restrictive. I have used Rails, but my web framework of choice is Tornado; I really like their design choices.
- Murkin 16y ago-1 On the community - StackOverflow alone is enough to find / get you answers to 99% of your questions in seconds. +1 On the extensions - They almost never work out of the box and require extensive changes (or usually rewrites). Seems like Django people never figured out how to create portable apps for Django. (And the comment app is Horrible !)
- matrix 16y agoI feel the main problem with extensions is that the "application" level of abstraction doesn't work very well in practice. It was an ambitious idea, but there are too many dependencies for that to be feasible. That said, I still like Django for quickly banging out moderately complex apps.
- bmelton 16y agoCompletely offtopic, but I replied to the OP (on reddit) and remembered a problem of my own that I'm having, and I can't quite figure out how to solve. Nginx + Django -- I have wildcard DNS on mydomain.com, and want to support customers such that customer1.mydomain.com gets its own database. I thought I'd be able to use fastcgi_param to inject a variable to fcgi, and then read it with os.environ.get('fastcgi_param'), and then 'IF' the settings.py to import customer1.settings.py (to override the database), but I can't seem to make it work. Any thoughts?
- danieldon 16y agohttp://news.ycombinator.com/item?id=1566709 http://news.ycombinator.com/item?id=1566709
- bmelton 16y agoWell, thanks for the response, despite the downvote. That said, it may seem like a 'bad' idea, as I understand the pitfalls in managing a consistent data schema across n databases, but it also seems like a much more performant idea than building a customer table and having to do an extra join on every read query for every ticket for every logged in user.
- deleted 16y ago[deleted]
- danieldon 16y agoI didn't downvote you, bmelton. it also seems like a much more performant idea Why is performance important to you? Presumably to make it cheaper to run, in which case I suggest you weigh the costs of coding and maintaining multiple dbs against the cost of that extra join. Note that the multiple db approach is already costing you since you are still trying to get it to work while you could already gave the single db approach in place relatively painlessly.
- rcoder 16y agoThere are several options here. First, you could use the Django "sites" framework, which has the advantage of being idiomatic and familiar to other Django developers: http://docs.djangoproject.com/en/dev/ref/contrib/sites/ http://docs.djangoproject.com/en/dev/ref/contrib/sites/ Second, you could define a database backend per customer (using the Django 1.2 multi-DB support) and write a custom database router that is aware of your custom FastCGI environment variables: http://docs.djangoproject.com/en/dev/topics/db/multi-db/ http://docs.djangoproject.com/en/dev/topics/db/multi-db/ Third (and best, IMHO) would be to run separate FastCGI processes for each customer, and route appropriately from Nginx. This approach is obviously the most complex setup, but it has the major advantage of letting you run every customer's FCGI backend under a different user id, offering yet another level of protection against data leakage and other security issues.
- fakr 16y agoThe real issue I have with Django - and extensions such as comments - is that in some ways it feels like a CMS masquerading as a framework. Take for example contrib.auth - it defines User, Group and Permission models for you. Frequently this is an issue - what if I don't want a username of 30 characters ? What if I want OpenID authentication instead ? Sure, you can override this but then you find that a whole lot of 3rd party apps - comments, admin etc - rely on these models, which in turn depend on lower-level functionality such as the ORM or templates. The very fact that you have a framework telling you what your data model should look like just feels "wrong". Does this mean that you shouldn't use Django ? Absolutely not, there are many projects suited to Django - especially content sites where you are putting together large building blocks with some homemade glue. But I've found it more trouble than worth for smaller projects, or where you have very specific requirements - in these cases (assuming you want to stay in Python) - I'd recommend Flask or Pylons. Unfortunately Django has become the new Blub framework for Python web development, which means it's used by companies by default, rather than being a useful but limited tool in the toolbox.
- jonknee 16y agoAlternate login backends are supported and documented. OpenID is as easy as a package install and adding a few settings. https://launchpad.net/django-openid-auth https://launchpad.net/django-openid-auth works well and it integrates into auth.
- fakr 16y agoYou completely missed my points: 1. The framework should not define your data model. 2. Many 3rd party apps depend on the existing User and other auth models.
- jonknee 16y agoI still must be missing your point... What would you prefer? If there was no contrib.auth then at best you'd have to do it all yourself which still means customizing third-party apps.
- deleted 16y ago[deleted]
- moron4hire 16y agoHere's the problem: "I have spent 2 years trying to learn django, why should I waste it? I'm 19 years old now..." A) 2 years of programming experience in any language is not a waste of time even if you never touch that language again, B) Sunk costs, if the previous 2 years were a mistake, then don't repeat that mistake by sticking to a language and framework you don't like. C) 2 years is nothing.
- run4yourlives 16y agoD) You're fricken' 19. You're supposed to be "wasting time". You can't find the right path for you until you determine some of them are dead ends.
- moron4hire 16y agoAbsolutely. He needs to be spending time reading literature and visiting art museums and hiking in the woods and fooling around with girls. There's plenty of time to work when you're old.
- Hovertruck 16y agoAs I sit at my desk at age 20 with a cup of coffee. :(
- run4yourlives 16y agoAt 20 I was running around playing GI Joe in the forest. It wasn't until 23 that I realized that shit was real. At 35 now I certainly don't consider any of that time wasted. I would suggest if you are "frowning" now - as you put in your comment - to get out and do something that doesn't make you frown... the cup of coffee will still be there, I guarantee it.
- dstein 16y agoIt's okay to not like frameworks. My opinion is that frameworks, in general, make easy things a little bit easier, and make hard things even harder.
- deleted 16y ago[deleted]
- bhdz 16y agoModel package management: It's a dirty kludge. Not documented (last time I've checked), I had to search hard to get it right. You must edit models/__init__.py such that: import X from Y ...and then each model must have class Meta: app_label = 'foobar' Without the meta information Django cannot load the models inside the package, it imports only models.py. May be it should be automated (model loader)? For instance, the model loader could parse the directory tree and import all necessary info it needs(meta information, optional), all is needed is a function for it :-/ edit: Format, gramer :) edit2: Phah! OK. I'm gonna do it. Automatic model loader function, Django extension :) (May be next week...)
- bhdz 16y agoOk HN :-/ However, for those interested in model package loading automation, I started a section on reddit: http://www.reddit.com/r/django/comments/d1ulg/automatic_models_package_loader_django_extension_d/ http://www.reddit.com/r/django/comments/d1ulg/automatic_mode..., may be I'm wrong... Sorry for bothering you...