Re: Pylon with Apache

2007-04-29 Thread Wichert Akkerman

There is also another way of integrating with apache:
http://www.rkblog.rk.edu.pl/w/p/mod_wsgi/

Wichert.

Previously Graham Dumpleton wrote:
 
 
 
 On Apr 28, 6:40 am, Cliff Wells [EMAIL PROTECTED] wrote:
  On Fri, 2007-04-27 at 07:36 -0600, Orr, Steve wrote:
   What are the advantages/disadvantages pros/cons to doing a proxy instead 
   of just usingmod_python?
 
  Typically, proxying is:
 
  1. easier to setup thanmod_python
  2. easier to upgrade Python (nomod_python/python version issues)
 
 Can you elaborate further on what the specific mod_python/python
 versions issues are? Note that I ask this to learn what the problems
 supposedly are and why it may be any more problematic than having to
 recompile any third party C extension modules for Python which you may
 have also installed into the Python site packages directory. Such
 feedback would be useful because although people grumble about this
 and use it as a reason against using mod_python, those same people
 never actually come over to the mod_python mailing list to describe
 the problems so that mod_python may if required be improved or so they
 may be corrected in their understanding as to how things work.
 
 FWIW, here are the specific issues that are already known about in
 respect of Python version issues when using mod_python. Do your
 specific problems match one of these or are they something else?
 
 First issue is not actually mod_python's fault and arises from fact
 that most binary Python distributions are not configured with --enable-
 shared. This means that no shared library is generated for Python,
 only a static library. The consequence of this is that the static
 objects have to be embedded within the mod_python.so Apache module. If
 one later upgrades Python to a newer patch revision of the same major/
 minor version but don't correspondingly recompile mod_python or obtain
 correct new binary version of it, you run the risk of problems because
 the core Python code you would be running would be older and not match
 the Python code files and Python C extension modules in the Python
 installation. Newer versions of mod_python will log warnings in the
 Apache error log when this problem occurs.
 
 The second issue is not completely mod_python's fault but arises from
 how Python works out where the installed Python code files and
 extension modules are installed. That is, how it works out what to set
 sys.prefix and sys.exec_prefix to. The way Python when being
 initialised does this is to find which 'python' executable is in its
 PATH and then from that try and work out where the library directory
 is. Problem with this is if you have multiple Python installations of
 the same major/minor version number but different patch revision
 installed in totally different locations, eg., /usr/bin and /usr/local/
 bin, it can find the wrong version as the Python version you want may
 not be that in the PATH for the user Apache is started as.
 
 With mod_python only way around this is to set PATH, PATHEXECUTABLE or
 PATHHOME environment variables in the environment of the user that
 Apache is started as. What should be done is for new directives to be
 added to mod_python called PythonExecutable and PythonHome which
 achieve the same thing so it can be done in Apache configuration
 instead. This would make it easier to resolve for those small
 percentage of people who have multiple Python installations on their
 system.
 
 Upgrading to a completely new major/minor version of Python without
 also using a recompiled version of mod_python will obviously also
 create lots of problems as it will continue to use an older version of
 Python, or may not even be able to find the installed mod_python
 Python code files anymore if old installation of Python was removed.
 
 The only other problem area is transitioning to a newer version of
 Python using the same system. That is, where you might want to be able
 to run applications using different versions of Python. To do this
 would mean running two distinct instances of Apache on the same box
 but with different installations of mod_python/Python. Preferably if
 doing this one should just perhaps use two different hosts.
 
 So except for the two quite specific issues noted above, are your
 problems perhaps really just an issue of dependency management,
 something that is going to occur for any software components and not
 just mod_python itself?
 
 Any feedback would be most appreciated so the real problems can be
 understood. Unfortunately when I have tried to dig into such claims in
 the past, there is usually dead silence, so can never find out what
 the real problems are so they can be addressed in mod_python if need
 be. :-(
 
 Graham
 
  3. doesn't require restarting Apache as often
  4. just as fast
  5. frees you from having to use Apache at all (other proxy solutions are
  available that are usually faster and lighter than Apache)
 
  Regards,
  Cliff
 
 
  

-- 
Wichert Akkerman [EMAIL 

Re: Pylon with Apache

2007-04-29 Thread Cliff Wells

On Sun, 2007-04-29 at 11:21 +0200, Wichert Akkerman wrote:
 There is also another way of integrating with apache:
 http://www.rkblog.rk.edu.pl/w/p/mod_wsgi/

When I saw this module, I thought oh, cool and actually (briefly)
considered trying to port it to Nginx, but came back to the arguments I
outlined here and ultimately decided against it.   Proxying is just too
dead simple and flexible.  It would take demonstrably huge performance
gains to change my mind.

Regards,
Cliff



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Dave Kuhlman Pylons docs

2007-04-29 Thread voltron

The Pylons docs from Dave Kuhlman are excellent! These really cleared
up my slightly hazy view of Pylons. In fact, almost all of the
questions which I had lined up to ask, and those I have asked are
discussed very clearly in it.

Would the Pylons Dev consider adding a link from the Pylons page or
even better, integrating some of the content in the Pylons tutorial
and first steps?

Link: http://www.rexx.com/~dkuhlman


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



extending BaseController

2007-04-29 Thread Antipin Aleksei

Hi

I don't understand why simple inheritance does not work:
base.py
class BaseController(WSGIController):
def __call__(self, environ, start_response):
# Insert any code to be run per request here. The Routes match
# is under environ['pylons.routes_dict'] should you want to check
# the action or route vars here
return WSGIController.__call__(self, environ, start_response)
   
def __before__ (self, action, **params):
print '__before'
pass
   
def user(self):
return session.get('user', None)


index.py:
from pyoner.lib.base import *

class IndexController(BaseController):
def index(self):
c.login = {'username': self.user()}
return render_response('/index.html')



Here I get error *type 'exceptions.AttributeError': type object 
'BaseController' has no attribute 'user'*

In BaseController I tried user = classmethod(user), in IndexController 
- self.user(), self.user(self), BaseController.user(), 
BaseController.user(self)

Could anybody point to some silly mistake here?

Thanks in advance,

Best regards,
Antipin Aleksei


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: extending BaseController

2007-04-29 Thread Ben Bangert

On Apr 29, 2007, at 8:32 AM, Antipin Aleksei wrote:

 Here I get error *type 'exceptions.AttributeError': type object
 'BaseController' has no attribute 'user'*

 In BaseController I tried user = classmethod(user), in  
 IndexController
 - self.user(), self.user(self), BaseController.user(),
 BaseController.user(self)

 Could anybody point to some silly mistake here?

That definitely should work, can you try throwing a 'raise' in your  
subclassed method and do a dir() on the controller in the interactive  
debugger? The thing you want to check, is that your controller is  
inheriting from the right class in the right path. Ie. is it possible  
you have an older version of the app without that attribute on the  
PYTHONPATH that is being imported instead of yours?

HTH,
Ben

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---