Re: Support for WSGI applications within Django (Ticket #12091)

2014-03-07 Thread Gustavo Narea
Hello, everybody.

Sorry for re-opening this old conversation, but I still haven't heard from 
you.

I'm not sure whether that means that there's no interest in this, or it's 
just that you've been busy.

Cheers,

 - Gustavo.

On Friday, September 6, 2013 11:51:01 AM UTC+1, Gustavo Narea wrote:
>
> Hello, Jacob et al.
>
> I was wondering whether there's an update on this.
>
> I'm still interested to learn about the concerns about the implementation, 
> so that I can know what to focus on. And also whether it's even worth me 
> doing a new implementation.
>
> Cheers,
>
>  - Gustavo.
>
>
> On Thursday, April 18, 2013 9:22:34 AM UTC+1, Gustavo Narea wrote:
>>
>> Hello,
>>
>> Any update on this?
>>
>> Cheers.
>>
>>  - Gustavo.
>>
>> On Friday, April 12, 2013 3:29:49 PM UTC+1, Gustavo Narea wrote:
>>>
>>> Hi Jacob,
>>>
>>> On Friday, April 12, 2013 3:09:40 PM UTC+1, Jacob Kaplan-Moss wrote:

 On Fri, Apr 12, 2013 at 8:54 AM, Gustavo Narea 
  wrote: 
 > So I guess that means that it won't be considered for inclusion in 
 Django? 
 > If so, I'll close that ticket. 

 Hm, I wouldn't be so hasty -- it's something I, at least, would like to 
 include. 

 Of course, the concerns about the implementation are still there, and 
 they're non-trivial. So my actual yes/no would be based more on the 
 concrete proposal. But I think it'd be a good idea to include in core 
 *if* it can be done well. 

 I know it's a lot to ask given the mixed messages so far, but would 
 you be OK preparing a patch/pull request for us to discuss? 

>>>
>>> I'm glad to hear you're interested.
>>>
>>> I'm absolutely confident that it can be done well. (I'm pretty familiar 
>>> with WSGI and Django's handlers implementation, and I've been using my 
>>> implementation in a high-traffic site for 3 years with not a single bug 
>>> found so far.)
>>>
>>> I'd be happy to update the patch I attached to the ticket and make a 
>>> pull request. But before I go ahead and spend time doing that, would you 
>>> mind if I address any concerns that you may still have now? I'd prefer to 
>>> save the time if it's not going to be accepted anyway.
>>>
>>> Cheers,
>>>
>>>  - Gustavo.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/bd992d07-a4b1-48a0-8c6d-d2d5ea9d01bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Support for WSGI applications within Django (Ticket #12091)

2013-09-06 Thread Gustavo Narea
Hello, Jacob et al.

I was wondering whether there's an update on this.

I'm still interested to learn about the concerns about the implementation, 
so that I can know what to focus on. And also whether it's even worth me 
doing a new implementation.

Cheers,

 - Gustavo.


On Thursday, April 18, 2013 9:22:34 AM UTC+1, Gustavo Narea wrote:
>
> Hello,
>
> Any update on this?
>
> Cheers.
>
>  - Gustavo.
>
> On Friday, April 12, 2013 3:29:49 PM UTC+1, Gustavo Narea wrote:
>>
>> Hi Jacob,
>>
>> On Friday, April 12, 2013 3:09:40 PM UTC+1, Jacob Kaplan-Moss wrote:
>>>
>>> On Fri, Apr 12, 2013 at 8:54 AM, Gustavo Narea 
>>>  wrote: 
>>> > So I guess that means that it won't be considered for inclusion in 
>>> Django? 
>>> > If so, I'll close that ticket. 
>>>
>>> Hm, I wouldn't be so hasty -- it's something I, at least, would like to 
>>> include. 
>>>
>>> Of course, the concerns about the implementation are still there, and 
>>> they're non-trivial. So my actual yes/no would be based more on the 
>>> concrete proposal. But I think it'd be a good idea to include in core 
>>> *if* it can be done well. 
>>>
>>> I know it's a lot to ask given the mixed messages so far, but would 
>>> you be OK preparing a patch/pull request for us to discuss? 
>>>
>>
>> I'm glad to hear you're interested.
>>
>> I'm absolutely confident that it can be done well. (I'm pretty familiar 
>> with WSGI and Django's handlers implementation, and I've been using my 
>> implementation in a high-traffic site for 3 years with not a single bug 
>> found so far.)
>>
>> I'd be happy to update the patch I attached to the ticket and make a pull 
>> request. But before I go ahead and spend time doing that, would you mind if 
>> I address any concerns that you may still have now? I'd prefer to save the 
>> time if it's not going to be accepted anyway.
>>
>> Cheers,
>>
>>  - Gustavo.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Support for WSGI applications within Django (Ticket #12091)

2013-04-18 Thread Gustavo Narea
Hello,

Any update on this?

Cheers.

 - Gustavo.

On Friday, April 12, 2013 3:29:49 PM UTC+1, Gustavo Narea wrote:
>
> Hi Jacob,
>
> On Friday, April 12, 2013 3:09:40 PM UTC+1, Jacob Kaplan-Moss wrote:
>>
>> On Fri, Apr 12, 2013 at 8:54 AM, Gustavo Narea 
>>  wrote: 
>> > So I guess that means that it won't be considered for inclusion in 
>> Django? 
>> > If so, I'll close that ticket. 
>>
>> Hm, I wouldn't be so hasty -- it's something I, at least, would like to 
>> include. 
>>
>> Of course, the concerns about the implementation are still there, and 
>> they're non-trivial. So my actual yes/no would be based more on the 
>> concrete proposal. But I think it'd be a good idea to include in core 
>> *if* it can be done well. 
>>
>> I know it's a lot to ask given the mixed messages so far, but would 
>> you be OK preparing a patch/pull request for us to discuss? 
>>
>
> I'm glad to hear you're interested.
>
> I'm absolutely confident that it can be done well. (I'm pretty familiar 
> with WSGI and Django's handlers implementation, and I've been using my 
> implementation in a high-traffic site for 3 years with not a single bug 
> found so far.)
>
> I'd be happy to update the patch I attached to the ticket and make a pull 
> request. But before I go ahead and spend time doing that, would you mind if 
> I address any concerns that you may still have now? I'd prefer to save the 
> time if it's not going to be accepted anyway.
>
> Cheers,
>
>  - Gustavo.
>

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




Re: Support for WSGI applications within Django (Ticket #12091)

2013-04-12 Thread Gustavo Narea
Hi Jacob,

On Friday, April 12, 2013 3:09:40 PM UTC+1, Jacob Kaplan-Moss wrote:
>
> On Fri, Apr 12, 2013 at 8:54 AM, Gustavo Narea 
>  wrote: 
> > So I guess that means that it won't be considered for inclusion in 
> Django? 
> > If so, I'll close that ticket. 
>
> Hm, I wouldn't be so hasty -- it's something I, at least, would like to 
> include. 
>
> Of course, the concerns about the implementation are still there, and 
> they're non-trivial. So my actual yes/no would be based more on the 
> concrete proposal. But I think it'd be a good idea to include in core 
> *if* it can be done well. 
>
> I know it's a lot to ask given the mixed messages so far, but would 
> you be OK preparing a patch/pull request for us to discuss? 
>

I'm glad to hear you're interested.

I'm absolutely confident that it can be done well. (I'm pretty familiar 
with WSGI and Django's handlers implementation, and I've been using my 
implementation in a high-traffic site for 3 years with not a single bug 
found so far.)

I'd be happy to update the patch I attached to the ticket and make a pull 
request. But before I go ahead and spend time doing that, would you mind if 
I address any concerns that you may still have now? I'd prefer to save the 
time if it's not going to be accepted anyway.

Cheers,

 - Gustavo.

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




Re: Support for WSGI applications within Django (Ticket #12091)

2013-04-12 Thread Jacob Kaplan-Moss
On Fri, Apr 12, 2013 at 8:54 AM, Gustavo Narea
 wrote:
> So I guess that means that it won't be considered for inclusion in Django?
> If so, I'll close that ticket.

Hm, I wouldn't be so hasty -- it's something I, at least, would like to include.

Of course, the concerns about the implementation are still there, and
they're non-trivial. So my actual yes/no would be based more on the
concrete proposal. But I think it'd be a good idea to include in core
*if* it can be done well.

I know it's a lot to ask given the mixed messages so far, but would
you be OK preparing a patch/pull request for us to discuss?

Jacob

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




Re: Support for WSGI applications within Django (Ticket #12091)

2013-04-12 Thread Gustavo Narea
Hello, Carl and Alex,

You're right: Apart from not being able to embed Django sites, there's 
nothing preventing twod.wsgi from working with Django as it is now.

So I guess that means that it won't be considered for inclusion in Django? 
If so, I'll close that ticket.

Cheers,

 - Gustavo.



On Thursday, April 11, 2013 3:31:51 PM UTC+1, Gustavo Narea wrote:
>
> Hello, everybody.
>
> In the interest of finding a resolution to Ticket 
> #12091, a 
> 3-year-old ticket, I wanted to bring this issue to your attention.
>
> I think that Django should have built-in support for running WSGI 
> applications from inside views. (NB: I really mean running WSGI apps from 
> inside Django views -- I'm not talking about using a WSGI middleware that 
> routes requests to your Django project or another WSGI application.)
>
> If you're able to embed WSGI applications in your Django project, you'd be 
> able to do many things. For example:
>
>- Control access to static files, while still letting your Web server 
>do the file transfer: http://pythonhosted.org/xsendfile/
>- Re-use your Django-based authentication in other applications, even 
>applications not written in Python. For example, if your Django site runs 
>at "/" and your Wordpress blog and Trac instance live at "/blog/" and 
>"/tickets/", respectively, your users would only have to log in once if 
>your Django site proxies requests to Wordpress and Trac. Here's how I've 
>integrate them in the past: https://bitbucket.org/Gustavo/weesgo/ and 
>http://gustavonarea.net/files/talks/europython2010/all-materials.zip
>- Alter the response returned by another web application or web site, 
>using HttpResponse objects.
>
> It basically comes down to being able to integrate other applications and 
> websites, and then filter the requests they get and/or the responses they 
> return -- Using Django request and response objects.
>
> I decided to reimplement the patch I created 3 years ago in a separate 
> project 
> (twod.wsgi), 
> which means that it's possible to do this without changing Django. However, 
> it doesn't support embedding Django projects because of Django's use of 
> global data (DJANGO_SETTINGS_MODULE and django.conf.settings), which I 
> think can only be solved by introducing thread locals in django.conf. At 
> the moment, the only way to accomplish this would be by proxying the second 
> Django site with inter-process communication (e.g., CGI, FastCGI or HTTP).
>
> I'm not going to insist on adding support for embedding other Django 
> projects, because I personally haven't had the need to do that and 
> introducing thread locals in django.conf may be controversial. But I guess 
> it might be useful to other people.
>
> So, do you agree that Django should have built-in support for running WSGI 
> applications from inside views?
>
> Thanks in advance!
>
>  - Gustavo Narea.
>

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




Re: Support for WSGI applications within Django (Ticket #12091)

2013-04-11 Thread Alex Ogier
On Thu, Apr 11, 2013 at 1:02 PM, Carl Meyer  wrote:
> On 04/11/2013 08:31 AM, Gustavo Narea wrote:
>> I decided to reimplement the patch I created 3 years ago in a separate
>> project (twod.wsgi
>> ), which
>> means that it's possible to do this without changing Django. However, it
>> doesn't support embedding Django projects because of Django's use of
>> global data (DJANGO_SETTINGS_MODULE and django.conf.settings), which I
>> think can only be solved by introducing thread locals in django.conf. At
>> the moment, the only way to accomplish this would be by proxying the
>> second Django site with inter-process communication (e.g., CGI, FastCGI
>> or HTTP).
>
> If I understand correctly, this latter limitation is not something that
> would be solved by integrating twod.wsgi into Django core. Are there any
> issues or problems with twod.wsgi that would be solved by integrating it
> into core?

There's a wiki article on the global state issue in Django at
https://code.djangoproject.com/wiki/GlobalState but this is unlikely
to be solved soon. It's something of a painful transition, because
Django has built up a large ecosystem that depends on this global
state. The reason is basically that it simplified implementation
greatly, especially considering that Python's module/namespace system
is deeply global. Frameworks like Flask have worked hard to avoid
global state from the very beginning, for example Flask requires all
"official extensions" to support multi-tenant applications explicitly,
and recommends a pattern where WSGI applications are created by a
factory function. Changing the Django ecosystem to allow for reliable
multitenancy would be prohibitively disruptive.

>> So, do you agree that Django should have built-in support for running
>> WSGI applications from inside views?
>
> I'm inclined to agree with Aymeric's position on the ticket: this is a
> useful feature for some scenarios, but it works just fine as a
> standalone project, and I just don't see enough demand for it to justify
> adding the maintenance burden for it to core.
>
> Carl

I think this is a common (and I think correct) response to many
feature requests: If there is anything in core that is blocking the
external implementation of a feature like this, it's worth looking at,
else just implement it outside of core. Particularly in this instance
since it will still be impossible to embed Django applications
anyways.

Best,
Alex Ogier

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




Re: Support for WSGI applications within Django (Ticket #12091)

2013-04-11 Thread Carl Meyer
Hello Gustavo,

On 04/11/2013 08:31 AM, Gustavo Narea wrote:
> In the interest of finding a resolution to Ticket #12091
> , a 3-year-old ticket, I
> wanted to bring this issue to your attention.
> 
> I think that Django should have built-in support for running WSGI
> applications from inside views. (NB: I really mean running WSGI apps
> from inside Django views -- I'm not talking about using a WSGI
> middleware that routes requests to your Django project or another WSGI
> application.)
> 
> If you're able to embed WSGI applications in your Django project, you'd
> be able to do many things. For example:
> 
>   * Control access to static files, while still letting your Web server
> do the file transfer: http://pythonhosted.org/xsendfile/
>   * Re-use your Django-based authentication in other applications, even
> applications not written in Python. For example, if your Django site
> runs at "/" and your Wordpress blog and Trac instance live at
> "/blog/" and "/tickets/", respectively, your users would only have
> to log in once if your Django site proxies requests to Wordpress and
> Trac. Here's how I've integrate them in the
> past: https://bitbucket.org/Gustavo/weesgo/
> and http://gustavonarea.net/files/talks/europython2010/all-materials.zip
>   * Alter the response returned by another web application or web site,
> using HttpResponse objects.
> 
> It basically comes down to being able to integrate other applications
> and websites, and then filter the requests they get and/or the responses
> they return -- Using Django request and response objects.

This does seem like a useful feature for some situations, though it's
not a feature that I've seen much demand for.

> I decided to reimplement the patch I created 3 years ago in a separate
> project (twod.wsgi
> ), which
> means that it's possible to do this without changing Django. However, it
> doesn't support embedding Django projects because of Django's use of
> global data (DJANGO_SETTINGS_MODULE and django.conf.settings), which I
> think can only be solved by introducing thread locals in django.conf. At
> the moment, the only way to accomplish this would be by proxying the
> second Django site with inter-process communication (e.g., CGI, FastCGI
> or HTTP).

If I understand correctly, this latter limitation is not something that
would be solved by integrating twod.wsgi into Django core. Are there any
issues or problems with twod.wsgi that would be solved by integrating it
into core?

> So, do you agree that Django should have built-in support for running
> WSGI applications from inside views?

I'm inclined to agree with Aymeric's position on the ticket: this is a
useful feature for some scenarios, but it works just fine as a
standalone project, and I just don't see enough demand for it to justify
adding the maintenance burden for it to core.

Carl

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




Support for WSGI applications within Django (Ticket #12091)

2013-04-11 Thread Gustavo Narea
Hello, everybody.

In the interest of finding a resolution to Ticket 
#12091, a 
3-year-old ticket, I wanted to bring this issue to your attention.

I think that Django should have built-in support for running WSGI 
applications from inside views. (NB: I really mean running WSGI apps from 
inside Django views -- I'm not talking about using a WSGI middleware that 
routes requests to your Django project or another WSGI application.)

If you're able to embed WSGI applications in your Django project, you'd be 
able to do many things. For example:

   - Control access to static files, while still letting your Web server do 
   the file transfer: http://pythonhosted.org/xsendfile/
   - Re-use your Django-based authentication in other applications, even 
   applications not written in Python. For example, if your Django site runs 
   at "/" and your Wordpress blog and Trac instance live at "/blog/" and 
   "/tickets/", respectively, your users would only have to log in once if 
   your Django site proxies requests to Wordpress and Trac. Here's how I've 
   integrate them in the past: https://bitbucket.org/Gustavo/weesgo/ 
   and http://gustavonarea.net/files/talks/europython2010/all-materials.zip
   - Alter the response returned by another web application or web site, 
   using HttpResponse objects.

It basically comes down to being able to integrate other applications and 
websites, and then filter the requests they get and/or the responses they 
return -- Using Django request and response objects.

I decided to reimplement the patch I created 3 years ago in a separate 
project 
(twod.wsgi), 
which means that it's possible to do this without changing Django. However, 
it doesn't support embedding Django projects because of Django's use of 
global data (DJANGO_SETTINGS_MODULE and django.conf.settings), which I 
think can only be solved by introducing thread locals in django.conf. At 
the moment, the only way to accomplish this would be by proxying the second 
Django site with inter-process communication (e.g., CGI, FastCGI or HTTP).

I'm not going to insist on adding support for embedding other Django 
projects, because I personally haven't had the need to do that and 
introducing thread locals in django.conf may be controversial. But I guess 
it might be useful to other people.

So, do you agree that Django should have built-in support for running WSGI 
applications from inside views?

Thanks in advance!

 - Gustavo Narea.

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