
I have tried to be happy with django, I really have. - bensummers
http://www.reddit.com/r/django/comments/d1gjk/i_have_tried_to_be_happy_with_django_i_really_have/
======
edanm
The 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
I 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.

~~~
edanm
One 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.

~~~
anthonyb
Another 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...

------
fakr
The 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
Alternate 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> works well and it integrates into auth.

~~~
fakr
You 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
I 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.

~~~
fakr
Authentication is something in my experience that is specific to an individual
project. I don't want to be told what database schema I must use to store my
user data - that's a specific project requirement (unless I'm building a
cookie-cutter site, which Django is good at, as I've stated).

So what do I want ? For authentication there are some common requirements:

\- session/cookie management to store a user ID (or other info)

\- hooks/middleware/whatever to allow me to check user credentials on each
request

\- safe hashing/encryption of passwords

\- form processing/validation

\- integration with OpenID, oAuth, LDAP etc

If a framework, or libraries, provide these then that saves a lot of time and
effort, and allows me to create a tailor-made solution.

~~~
jonknee
You can do all of these with Django, but not unexpectedly it won't magically
work with other people's code. I don't know how it could, if there's another
framework that does this I'm interested.

contrib.auth can be made to do most of these if you still want the ability to
play nice with other people's code who expect you to use auth. You'll have to
create and manage User objects which it sounds like you're unwilling to do,
but you can't have it both ways.

I think having it there is better than not. In most circumstances it saves me
a lot of time. If I come across a circumstance that I can't use it then I'm
just back to where I would be anyways and will have to write a lot more code
and modify 3rd party apps.

~~~
fakr
Exactly, it saves a lot of time when you want a cookie-cutter site using lots
of 3rd party apps. Not knocking that - there are lots of cases where that's
exactly what you need. But this is what reminds me more of a CMS like Drupal
than a framework - blocks of content managed by a single admin and
authentication system.

When I want to do something more original and specific where I don't need all
those apps, Django just gets in the way - and that's when I turn to a more
lightweight and flexible framework.

Use the best tool for the job. Sometimes Django is that tool. The problem I
have is with companies and individuals who think it's the _only_ tool.

------
moron4hire
Here'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
D) 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
Absolutely. 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
As I sit at my desk at age 20 with a cup of coffee. :(

~~~
run4yourlives
At 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.

------
Murkin
-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
I 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.

------
dstein
It'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.

------
bmelton
Completely 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?

~~~
rcoder
There 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/>

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/>

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.

~~~
anthonyb
The other advantage of the third option is that you don't have to write a
whole bunch of auth/filtering code to only show customers their own data. Row-
level permissions are relatively straightforward in Django, but it's still
easier not to have to deal with them.

------
newsisan
Is it really that bad? I get the impression that most are happy with Django
(or maybe that is other python frameworks.....).

~~~
endlessvoid94
It'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.

------
bhdz
Model 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
Ok 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_mode...](http://www.reddit.com/r/django/comments/d1ulg/automatic_models_package_loader_django_extension_d/),
may be I'm wrong...

Sorry for bothering you...

