Hello, Jari.

I'd recommend using twod.wsgi instead: http://bitbucket.org/2degrees/twod.wsgi/

It's very stable, full-feature and truly WSGI compliant. We've been
using heavily over the last 2 months. It started from this:
http://groups.google.com/group/django-developers/browse_thread/thread/08c7ffeee7b9343c

We'll release it officially soon, once I finish the documentation.
With twod,wsgi, you'd do the following:
====
from twod.wsgi import call_wsgi_app
from paste.fileapp import FileApp

def django_view(file_to_serve):
    return call_wsgi_app(FileApp(file_to_serve))
====

But note you'd need to use twod.wsgi's handler, which in a simple sub-
class of Django's WSGI handler. And because Django doesn't allow you
to use a different handler nor WSGI middleware in the development
server, you wouldn't be able to use that server. That's no big deal,
because you can use any server, including PasteScript (the one used by
all the other WSGI frameworks; which I personally believe outperforms
Django's).

So, you could use the following Paste file:
====
# whatever.ini
[DEFAULT]
debug = True

[server:devserver]
use = egg:Paste#http
port = 8000

[app:main]
# Dev mode
use = twod.wsgi
django_settings_module = yourpackage.settings

[app:deploy]
use = main
set debug = False
====

And insted of running "manage.py runserver", you'd run "paster serve
whatever.ini". Or, run just "./whatever.ini" if you put the following
at the top of the file:
====
#!/usr/bin/env paster

[exe]
command = serve
reload = true
====

Then, to deploy the application, instead of setting
DJANGO_SETTINGS_MODULE and importing Django's WSGI handler, you'd do
the following:
====
from paste.deploy import loadapp
application = loadapp("config:/path/to/whatever.ini#deploy")
====

That's it. Please stop by our Google Group (2degrees-dev) if you have
any question, since I don't normally keep an eye on this mailing list.

I understand it might seem more complicated, but it's not really
complicated. The problem is the need to bypass Django's handler, which
is required in order to make your application trully interoperable
with WSGI software. But I am 100% confident nothing will break in your
application. If it does (which is very very very unlikely), please
fill a bug report.

HTH,

Gustavo.
http://dev.2degreesnetwork.com

On Feb 10, 3:09 pm, Jari Pennanen <jari.penna...@gmail.com> wrote:
> Hi!
>
> I was wondering what is the status of branch branches/soc2009/http-
> wsgi-improvements 
> (http://github.com/django/django/tree/soc2009/http-wsgi-improvements
> )? I'm personally interested one bug it fixes, mainly ticket #2131
> (http://code.djangoproject.com/ticket/2131)
>
> The branch seems to be 6 months old, and this makes me nervous to rely
> on it, if it is not merged to trunk I'm screwed on relying on branch
> that old...

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to