Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
TurboGears apps with multiple web paths
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Christoph Zwerschke  
View profile  
 More options Jul 30 2008, 10:03 am
From: Christoph Zwerschke <c...@online.de>
Date: Wed, 30 Jul 2008 16:03:10 +0200
Local: Wed, Jul 30 2008 10:03 am
Subject: TurboGears apps with multiple web paths
When you're running several independent TG apps on the same web server,
e.g. www.company.com, the easiest methods are using named virtual hosts
like appname.company.com or using URLs like www.company.com/appname/.
The former looks nicer, but the simple named virtual hosts are not
possible with SSL.

So ideally, I'd like to allow both kinds of URLs for my applications at
the same time. But the problem is that you can set only one root path in
TG using server.webpath. If you set it to "/", then the URLs
www.company.com/appname/ will not run correctly. If you set it to
"/appname", then the URLs appname.company.com will get /appname/
appended, which looks ugly and defeats the purpose of having named
virtual hosts.

One solution would be to run every application twice on different ports,
one instance with server.webpath="/" and another instance with
server.webpath="/appname", and let Apache proxy to the respective ports.
Not a really nice solution.

Another solution would be to have TG support per-host server.webpaths,
depending on the scheme and hostname that is used in the URL. This could
be implemented by allowing server.webpath to be a full URL including
scheme and hostname, e.g. "https://www.company.com/appname", and the
prefix "/appname" would be only used as webpath when the request is
using "https://www.company.com". We could also allow it to be a list
with several such URLs. It would require only some small changes in
turbogears.startup and turbogears.controllers. Anybody besides me who
thinks this is a good idea?

Or are there better solutions?

-- Christoph


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lukasz Szybalski  
View profile  
 More options Jul 30 2008, 10:07 am
From: "Lukasz Szybalski" <szybal...@gmail.com>
Date: Wed, 30 Jul 2008 09:07:42 -0500
Local: Wed, Jul 30 2008 10:07 am
Subject: Re: [TurboGears] TurboGears apps with multiple web paths

Is there a reason you are not using mod_wsgi deployment to achieve above ?

Lucas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Arndt  
View profile  
 More options Jul 30 2008, 10:24 am
From: Christopher Arndt <chris.ar...@web.de>
Date: Wed, 30 Jul 2008 16:24:32 +0200
Local: Wed, Jul 30 2008 10:24 am
Subject: Re: TurboGears apps with multiple web paths
Lukasz Szybalski schrieb:

> On Wed, Jul 30, 2008 at 9:03 AM, Christoph Zwerschke <c...@online.de> wrote:
>> So ideally, I'd like to allow both kinds of URLs for my applications at
>> the same time. But the problem is that you can set only one root path in
>> TG using server.webpath.

> Is there a reason you are not using mod_wsgi deployment to achieve above ?

That's beside the question. Or can you show a way to solve the original
problem (running the application under two different webpaths) with
mod_wsgi?

Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jorge Godoy  
View profile  
 More options Jul 30 2008, 2:41 pm
From: Jorge Godoy <jgo...@gmail.com>
Date: Wed, 30 Jul 2008 15:41:50 -0300
Local: Wed, Jul 30 2008 2:41 pm
Subject: Re: [TurboGears] TurboGears apps with multiple web paths

On Wednesday 30 July 2008 11:03:10 Christoph Zwerschke wrote:

I can see some places where I could use that.  If tied together with master
templates per "root" in an easier way than today's callable solution this
could really be interesting for code reuse.

> Or are there better solutions?

I don't know.  I didn't stop to think about this yet because so far all
servers that I have installed applications are dedicated servers and only
serve one domain.

--
Jorge Godoy      <jgo...@gmail.com>

  signature.asc
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Graham Dumpleton  
View profile  
 More options Jul 30 2008, 8:19 pm
From: Graham Dumpleton <Graham.Dumple...@gmail.com>
Date: Wed, 30 Jul 2008 17:19:12 -0700 (PDT)
Local: Wed, Jul 30 2008 8:19 pm
Subject: Re: TurboGears apps with multiple web paths

Christopher Arndt wrote:
> Lukasz Szybalski schrieb:
> > On Wed, Jul 30, 2008 at 9:03 AM, Christoph Zwerschke <c...@online.de> wrote:
> >> So ideally, I'd like to allow both kinds of URLs for my applications at
> >> the same time. But the problem is that you can set only one root path in
> >> TG using server.webpath.

> > Is there a reason you are not using mod_wsgi deployment to achieve above ?

> That's beside the question. Or can you show a way to solve the original
> problem (running the application under two different webpaths) with
> mod_wsgi?

The issue is whether TG is a true WSGI friendly application or not. If
TG is a good WSGI citizen, then it should honour the SCRIPT_NAME
variable passed in by a WSGI adapater as being the mount point of the
application. That is, SCRIPT_NAME should be used in preference to
server.webpath, especially if server.webpath is not defined.

If TG honours this, then using mod_wsgi one could do the following:

  # Create WSGIDaemonProcess outside of VirtualHost so can be
  # delegated to by mulitple virtual hosts.

  WSGIDaemonProcess appname

  # Allow access to WSGI script file for application.

  <Directory /usr/local/turbogears/mysite/apache>

  # Delegate this TG application to 'appname' daemon process and
  # specifically the main interpreter in that process. Need to specify
  # application group else different mount points across virtual hosts
  # would result in there being multiple instances in process. Forcing
  # it to main interpreter means there will be only one instance of
  # application regardless of where it is mounted.

  WSGIProcessGroup appname
  WSGIApplicationGroup %{GLOBAL}

  Order deny,allow
  Allow from all
  </Directory>

  # Virtual host for appname.company.com.

  <VirtualHost *:80>
  ServerName appname.company.com

  WSGIProcessGroup appname
  WSGIApplicationGroup %{GLOBAL}

  WSGIScriptAlias / /usr/local/turbogears/mysite/apache/
turbogears.wsgi

  </VirtualHost>

  # Virtual host for main company site.

  <VirtualHost *:80>
  ServerName www.company.com

  WSGIScriptAlias /appname /usr/local/turbogears/mysite/apache/
turbogears.wsgi

  </VirtualHost>

In other words, create a single daemon process and delegate the TG
application to run in main interpreter in that process via directives
in Directory container where TG WSGI script file is saved.

Different virtual hosts can then mount the WSGI script file at
different mount points and all requests will go to single TG app in
the single daemon process.

As mentioned above, this depends on SCRIPT_NAME being honoured for the
mount point. Any URL construction should also honour that and the
server name, protocol etc as described in WSGI PEP at:

 http://www.python.org/dev/peps/pep-0333/#url-reconstruction

The question therefore is whether TG has been updated to be a well
behaved WSGI application yet as doing what is required is certainly
straight forward using mod_wsgi if it were. Based on documentation in:

  http://code.google.com/p/modwsgi/wiki/IntegrationWithTurboGears

for TG 1.X it doesn't however honour SCRIPT_NAME, but has TG 2.0 fixed
this so it is?

Graham


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Jul 31 2008, 12:23 pm
From: Christoph Zwerschke <c...@online.de>
Date: Thu, 31 Jul 2008 18:23:14 +0200
Local: Thurs, Jul 31 2008 12:23 pm
Subject: Re: [TurboGears] Re: TurboGears apps with multiple web paths
Graham Dumpleton schrieb:

> The issue is whether TG is a true WSGI friendly application or not. If
> TG is a good WSGI citizen, then it should honour the SCRIPT_NAME
> variable passed in by a WSGI adapater as being the mount point of the
> application. That is, SCRIPT_NAME should be used in preference to
> server.webpath, especially if server.webpath is not defined.

Godd point. Instead of server.webpath, TurboGears should regard
SCRIPT_NAME which at least 1.0 does not do. If I understand correctly,
the place where this must be fixed is the controllers.url function,
something like:

tgpath = config.get('server.webpath',
     cherrypy.request.wsgi_environ.get('SCRIPT_NAME', '')) + tgpath

Maybe we should fix this even in 1.0?

-- Christoph


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Jul 31 2008, 12:40 pm
From: Christoph Zwerschke <c...@online.de>
Date: Thu, 31 Jul 2008 18:40:30 +0200
Local: Thurs, Jul 31 2008 12:40 pm
Subject: Re: [TurboGears] Re: TurboGears apps with multiple web paths
Christopher Arndt schrieb:

> Lukasz Szybalski schrieb:
>> On Wed, Jul 30, 2008 at 9:03 AM, Christoph Zwerschke <c...@online.de> wrote:
>>> So ideally, I'd like to allow both kinds of URLs for my applications at
>>> the same time. But the problem is that you can set only one root path in
>>> TG using server.webpath.
>> Is there a reason you are not using mod_wsgi deployment to achieve above ?

> That's beside the question. Or can you show a way to solve the original
> problem (running the application under two different webpaths) with
> mod_wsgi?

As Graham already commented, mod_wsgi does in fact not help since TG
does not heed SCRIPT_NAME.

However, if you use mod_proxy, then there is no way to get hold of the
original URL, so having different prefixes will not be possible on
principle (at least if you run only one instance of the application).
This was probably was Lukasz meant. (Correct me if I'm wrong.)

-- Christoph


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christoph Zwerschke  
View profile  
 More options Aug 1 2008, 1:54 pm
From: Christoph Zwerschke <c...@online.de>
Date: Fri, 01 Aug 2008 19:54:29 +0200
Local: Fri, Aug 1 2008 1:54 pm
Subject: Re: [TurboGears] Re: TurboGears apps with multiple web paths
Just posted a patch for TG 1.0 as
http://trac.turbogears.org/ticket/1919

Using this patch and mod_wsgi, you can now have both schemes
www.company.com/appname/ and appname.company.com for your application,
without setting server.webpath at all. Works nicely.

Let me know your opinion. Should we apply the patch? Or only in 1.5? Any
improvements?

-- Christoph


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »