Let's be clear here - the "basic testing" thing that is failing here
is a very specific, and somewhat esoteric edge case - the case of a
view that invokes, via HTTP, another view on the same server. Client
side AJAX self-calls and using urllib to call a URL on another server
won't lock up the Django development server.
The Django core team has (repeatedly) made a very deliberate decision
to keep the development server single threaded. There are many very
good web servers out there - Django isn't trying to get into the game
of competing with any of them. We view Django's job as providing a
good web stack for a real web server to use; the development server is
provided as a convenience, nothing more.
Having a singlethreaded server makes the implementation much simpler,
so we can concentrate our efforts on making a great web stack, rather
than wasting effort on writing, debugging, and maintaining a web
server that we don't really want people to use for serious work.
A multithreaded server would also act as a tacit encouragement to use
Django's development server for real deployments, which we _really_
don't want to encourage. If people start using Django's development
server in production, we would have to start treating it as a
production-ready server - doing security and performance audits and
the like - and again, this distracts us from what we consider to be
the "main game".
The _only_ type of view that is affected by this decision is the view
that uses urllib (or equivalent) to invoke another view on the same
server. We (the Django core team) have decided that this is a
compromise we can live with. The set of cases where this behavior is
required is very small, doesn't form a part of the requirements for
most (almost all) web development projects. For that small subset of
users that _do_ have a legitimate use for this, there are some
lightweight multithreaded options (like CherryPy) out there, and to
the best of my knowledge, none of these options _require_ the patching
of core in order to use them.
Yours,
Russ Magee %-)
Sorry, but my stress-induced fibritis can only take so much. As a
hint, if you ever find yourself in a position where you need to
apologize at the end of an email for the tone you've taken, it's
probably a good indicator that you need to go back and edit for tone.
As a further hint, using pejoratives in project naming - like, say,
"Sane Testing in Django" - isn't a good way to encourage others to
assist you.
I've explained the reasoning behind Django's decisions. I can only
assure you that I know many people that aren't affected by those
decisions, and are able to use Django's testing framework, as is,
without difficulty. Some of them are even able to use Selenium.
If you sit down and work through the problem, you will establish that
the consequences of those decisions aren't as widespread as you seem
to think. There is _exactly_ one limitation to Django's development
server - _concurrent_ web requests. To be sure, this does impose
limitations, but as long as you don't need concurrent server requests,
you won't have any problems with a single-threaded server. Most web
pages can be adequately served by a number of _sequential_ web
requests.
I will also remind you that just because _you_ hit a given problem
every single day, doesn't mean that _everyone_ hits that problem every
single day. Such is the nature of esoteric problems.
You will note that so far in this thread, you haven't actually
described your problem - just that a multithreaded server is
apparently the only way to solve it. If you ever feel like describing
your problem (sans rhetoric) and working constructively towards a
solution, let me know.
Yours,
Russ Magee %-)
Perhaps you could show some simplified example code? I have at least a
few dozen tests that do this and they don't have any problem. Serial
requests work fine with the development server. I know of plenty of
other people doing similar things.
[...]
> OK, if it's not meant for serious development and testing work, I
> guess it's OK then.
Depends on your definition of "serious". Given the thousands of Django
applications that have, at least, started out using the development
server, your claim seems a little vacuous.
> (I'd just say that opitional multithreading contained in 10-line long
> patch is not so complicated)
>
> > A multithreaded server would also act as a tacit encouragement to use
> > Django's development server for real deployments, which we _really_
> > don't want to encourage. If people start using Django's development
> > server in production, we would have to start treating it as a
> > production-ready server - doing security and performance audits and
> > the like - and again, this distracts us from what we consider to be
> > the "main game".
>
> OK, if community is expected to ignore 'do not use this option for
> production or you'll be banned from all our communication channels on
> first complaint', I guess nothing can be done.
And if somebody had said that, you *might* even be have a semi-valid
complaint. What colour is the sky in your world? The "community" is not
expected to ignore the 'do not use in production'. They're expected to
read it and take it to heart. Nothing has ever been said about banning.
Russell pointed out something that has been mentioned multiple times in
the past: the development server has a well-defined role to play and the
step-up from there to using other servers when circumstances require is
incredibly minimal. Graham's blog post, given earlier in the thread,
about how to use mod_wsgi is just one example of that. Once we expand
the scope of the development server, it *will* be used in further
unintended ways and we *will* be obliged to maintain it, including
issuing security fixes and the like.
You might well have some reduced outlook on the time commitment involved
there, which is fine, since you aren't one of the people on the hook for
things like that in Django. The group of core maintainers have decided
to devote time elsewhere.
>
> i guess PHP users are our target group.
>
> > The _only_ type of view that is affected by this decision is the view
> > that uses urllib (or equivalent) to invoke another view on the same
> > server.
>
> Yes, that's the only type of view affected. And some tests...
>
> > We (the Django core team) have decided that this is a
> > compromise we can live with. The set of cases where this behavior is
> > required is very small, doesn't form a part of the requirements for
> > most (almost all) web development projects. For that small subset of
> > users that _do_ have a legitimate use for this, there are some
> > lightweight multithreaded options (like CherryPy) out there, and to
> > the best of my knowledge, none of these options _require_ the patching
> > of core in order to use them.
>
> Well, after I fall into small group of users that do some automatized
> acceptance testing (and thus require, like, Selenium) and discovered
> that things looks like working after I lobotomized Django and replaced
> it with CherryPy, I'm now satisfied.
When you could have just used mod_wsgi, or CherryPy's WSGI server or any
number of other things. Nice over-reaction there.
Note, also, that there's a ticket open in Trac to add some extra bits
and pieces for allowing Selenium integration with Django's test
framework. That would also give you some idea of the direction things
could go.
This was a very disappointing mail to read. Whilst I realise you might
well be frustrated, the tone is simply insulting to the amount of work
that has gone into developing and supporting Django and tries to inflate
whatever problem it is that you're having (which hasn't been explained
in detail) way out of proportion.
Regards,
Malcolm
-- Ned Batchelder, http://nedbatchelder.com