Python version and Apache mod_python mismatching version
Hello, I have a Centos7 web server with python 2.7 installed and I want Apache to serve python scripts so I figure I have to install mod_python: i know that this module is deprecated, but I need it only for internal pourposes. Is the mod_python version (which is 3.5 with Python 3 support) somehow related to the python interpreter the web server? Is there any problem if the mod_python version and python version didn't match? -- https://mail.python.org/mailman/listinfo/python-list
Apache/mod_python: Registering a request handler dynamically
Hi, Is there a way to dynamically overwrite the request handler from within mod_python scripts? Something along those lines: --- from mod_python import apache def myhandler(request): request.content_type = 'text/plain' request.write('Hello world') apache.set_default_handler(myhandler) --- I specifically want to avoid changing the Apache directive, as this code is supposed to function in a place where the user has no permission to override the Apache directive. The reason is that I am trying to hide the difference between different environments (such as mod_python or CGI) from the developer, such that the following is possible: --- #!/usr/bin/python import os, os.path os.chdir(os.path.dirname(__file__)) from PleaseHideMyEnvironment import RequestHandler def index(request): request.write('Hello World') RequestHandler(index) --- So at the time at which RequestHandler() is created, I need a way to make sure that mod_python calls to the RequestHandler instead of the normal handler, whenever a new request is made. Any idea? -Samuel -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache & mod_python: I don't receive anything with POST method
On 27 nov, 15:13, [EMAIL PROTECTED] wrote: > On 26 nov, 23:22, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > > > On Nov 27, 12:21 am, [EMAIL PROTECTED] wrote: > > > > Hi, > > > > I'm using a simple form to make possible the users of our site upload > > > files. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The "upload.py" looks like this: > > > > from mod_python import apache, util; > > > > def index(req): > > > form = util.FieldStorage(req, keep_blank_values=1) > > > try: > > > # form is empty here > > > # return form --> I get "{}" > > > ufile = form.get('upfile', None) > > > > if not form.has_key('upfile'): > > > return ":( No 'upfile' key" > > > > # some checks. I never get beyond here > > > > ufile = form['upfile'] > > > if ufile.file: > > > return ufile.file.name > > > else: > > > return ":( It's not a file" > > > except Exception, e: > > > return 'Fail: ' + str(e) > > > > I'm getting an empty 'form'. No 'upfile' key at all. I've tried to add > > > some other text fields but the result is the same: empty. If I use GET > > > method with text fields, it works properly. > > > > Currently I'm using: > > > Apache 2.2.9 (initially I used Apache 2.2.3 too) > > > mod_python 3.3.1 (initially I used mod_python 3.2.10 too) > > > Python 2.5.2 > > > Which is the correct result for the code you are using. > > > The problem is that you appear to be using mod_python.publisher which > > does its own form handling before you are even getting a chance, thus > > it is consuming the request content. > > > For how to handle forms in mod_python.publisher see: > > >http://webpython.codepoint.net/mod_python_publisher_forms > > > Graham > > Hi, > > I should get a non-empty "form". > > With the following html > > > > > > > > > > > > ...and the following "upload.py": > > from mod_python import util, apache > > def index(req): > form = util.FieldStorage(req, keep_blank_values=1) > try: > some_text = form.get('some_text', None); > return form.items > except Exception, e: > return 'Fail: ' + str(e) > > ...I get (writting "Python" in the text box) > > [('some_text', Field('some_text', 'Python'))] > > So, I have a "form" with a non-empty structure of (key, value), and > I'm able to get the value I'm looking for: > > ... > some_text = form.get('some_text', None) # It's not empty anymore > ... > > Thanks > > León I got an alternative solution here http://codepoint.net/index.php/topic,118.msg507.html#msg507 Regards -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache & mod_python: I don't receive anything with POST method
On 26 nov, 23:22, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Nov 27, 12:21 am, [EMAIL PROTECTED] wrote: > > > > > Hi, > > > I'm using a simple form to make possible the users of our site upload > > files. > > > > > > > > > > > > > > > > > > > > > > The "upload.py" looks like this: > > > from mod_python import apache, util; > > > def index(req): > > form = util.FieldStorage(req, keep_blank_values=1) > > try: > > # form is empty here > > # return form --> I get "{}" > > ufile = form.get('upfile', None) > > > if not form.has_key('upfile'): > > return ":( No 'upfile' key" > > > # some checks. I never get beyond here > > > ufile = form['upfile'] > > if ufile.file: > > return ufile.file.name > > else: > > return ":( It's not a file" > > except Exception, e: > > return 'Fail: ' + str(e) > > > I'm getting an empty 'form'. No 'upfile' key at all. I've tried to add > > some other text fields but the result is the same: empty. If I use GET > > method with text fields, it works properly. > > > Currently I'm using: > > Apache 2.2.9 (initially I used Apache 2.2.3 too) > > mod_python 3.3.1 (initially I used mod_python 3.2.10 too) > > Python 2.5.2 > > Which is the correct result for the code you are using. > > The problem is that you appear to be using mod_python.publisher which > does its own form handling before you are even getting a chance, thus > it is consuming the request content. > > For how to handle forms in mod_python.publisher see: > > http://webpython.codepoint.net/mod_python_publisher_forms > > Graham Hi, I should get a non-empty "form". With the following html ...and the following "upload.py": from mod_python import util, apache def index(req): form = util.FieldStorage(req, keep_blank_values=1) try: some_text = form.get('some_text', None); return form.items except Exception, e: return 'Fail: ' + str(e) ...I get (writting "Python" in the text box) [('some_text', Field('some_text', 'Python'))] So, I have a "form" with a non-empty structure of (key, value), and I'm able to get the value I'm looking for: ... some_text = form.get('some_text', None) # It's not empty anymore ... Thanks León -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache & mod_python: I don't receive anything with POST method
On Nov 27, 12:21 am, [EMAIL PROTECTED] wrote: > Hi, > > I'm using a simple form to make possible the users of our site upload > files. > > > > > > > > > > > > The "upload.py" looks like this: > > from mod_python import apache, util; > > def index(req): > form = util.FieldStorage(req, keep_blank_values=1) > try: > # form is empty here > # return form --> I get "{}" > ufile = form.get('upfile', None) > > if not form.has_key('upfile'): > return ":( No 'upfile' key" > > # some checks. I never get beyond here > > ufile = form['upfile'] > if ufile.file: > return ufile.file.name > else: > return ":( It's not a file" > except Exception, e: > return 'Fail: ' + str(e) > > I'm getting an empty 'form'. No 'upfile' key at all. I've tried to add > some other text fields but the result is the same: empty. If I use GET > method with text fields, it works properly. > > Currently I'm using: > Apache 2.2.9 (initially I used Apache 2.2.3 too) > mod_python 3.3.1 (initially I used mod_python 3.2.10 too) > Python 2.5.2 Which is the correct result for the code you are using. The problem is that you appear to be using mod_python.publisher which does its own form handling before you are even getting a chance, thus it is consuming the request content. For how to handle forms in mod_python.publisher see: http://webpython.codepoint.net/mod_python_publisher_forms Graham -- http://mail.python.org/mailman/listinfo/python-list
Apache & mod_python: I don't receive anything with POST method
Hi, I'm using a simple form to make possible the users of our site upload files. The "upload.py" looks like this: from mod_python import apache, util; def index(req): form = util.FieldStorage(req, keep_blank_values=1) try: # form is empty here # return form --> I get "{}" ufile = form.get('upfile', None) if not form.has_key('upfile'): return ":( No 'upfile' key" # some checks. I never get beyond here ufile = form['upfile'] if ufile.file: return ufile.file.name else: return ":( It's not a file" except Exception, e: return 'Fail: ' + str(e) I'm getting an empty 'form'. No 'upfile' key at all. I've tried to add some other text fields but the result is the same: empty. If I use GET method with text fields, it works properly. Currently I'm using: Apache 2.2.9 (initially I used Apache 2.2.3 too) mod_python 3.3.1 (initially I used mod_python 3.2.10 too) Python 2.5.2 Thanks Best regards, León -- http://mail.python.org/mailman/listinfo/python-list
Re: help with apache + mod_python on mac os x
I could correct version mismatch by handling files under: $ ls -l /usr/lib |grep python lrwxr-xr-x1 root wheel16 Feb 2 01:17 libpython.dy -> libpython2.dylib lrwxr-xr-x1 root wheel16 Feb 2 01:11 libpython2.5.dylib -> libpython2.dylib lrwxr-xr-x1 root wheel72 Feb 2 01:11 libpython2.dylib -> ../../System/Library/Frameworks/Python.framework/Versions/Current/Python lrwxr-xr-x1 root wheel79 Feb 2 01:10 python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/Current/lib/python2.5 /Developer/SDKs/MacOSX10.4u.sdk/usr/include and /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Python.framework/Versions Then re-compile apache & mod_python .. Regards, Deniz On Feb 1, 2008 11:47 PM, <[EMAIL PROTECTED]> wrote: > Hi, > I am new on everything about web development. I did many things to get the > error at the end. > My system has Apache 1.3 by default. I could install Apache 2.2 with no > problem. I had to change all binaries in /usr/bin and /usr/sbin to new > apache binaries. All ok. System came with python 2.3.1. I removed > everything related to 2.3.1 and installed python 2.5.1. > Then compiled mod_python successfully with parameters: ./configure > --apxs=/usr/sbin/apxs --python=/usr/bin/python > make > sudo make install > sudo make install_dso > $ python -V > Python 2.5.1 > $ strings /usr/local/apache2/modules/mod_python.so => > python_init > mod_python/3.3.1 > 2.5.1 > $ env |grep PATH > > PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:/bin:/sbin:/usr/bin:/usr/sbin > > $ sudo apachectl start > httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: > Cannot load /usr/local/apache2/modules/mod_python.so into server: Library > not loaded: > /System/Library/Frameworks/Python.framework/Versions/2.3/Python\n > Referenced from: /usr/local/apache2/modules/mod_python.so\n Reason: image > not found > /usr/sbin/apachectl start: httpd could not be started > > > How is it possible that LoadModule still seek at path Versions/2.3 ? > > Regards, > Deniz > > -- http://mail.python.org/mailman/listinfo/python-list
help with apache + mod_python on mac os x
Hi, I am new on everything about web development. I did many things to get the error at the end. My system has Apache 1.3 by default. I could install Apache 2.2 with no problem. I had to change all binaries in /usr/bin and /usr/sbin to new apache binaries. All ok. System came with python 2.3.1. I removed everything related to 2.3.1 and installed python 2.5.1. Then compiled mod_python successfully with parameters: ./configure --apxs=/usr/sbin/apxs --python=/usr/bin/python make sudo make install sudo make install_dso $ python -V Python 2.5.1 $ strings /usr/local/apache2/modules/mod_python.so => python_init mod_python/3.3.1 2.5.1 $ env |grep PATH PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:/bin:/sbin:/usr/bin:/usr/sbin $ sudo apachectl start httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_python.so into server: Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.3/Python\n Referenced from: /usr/local/apache2/modules/mod_python.so\n Reason: image not found /usr/sbin/apachectl start: httpd could not be started How is it possible that LoadModule still seek at path Versions/2.3 ? Regards, Deniz -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Dec 23, 2:47 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 22 Dec 2007 13:05:23 -0800, Dennis Lee Bieber wrote: > > I've never encountered such items > > supported by the language. > > >OS specific extensions MIGHT supply it... > > Picky picky... but of course you are right. When I said that programming > languages I have used before had facilities to measure memory usage, I > meant that the *implementation* had those facilities rather than the > language itself. yes, that's what this thread is about. " I'm really just looking for a low-level python (memory) profiling tool, and thus i'm asking in c.l.p. for experiences, mainly in context of an apache mod_python environment. " But seeing the responses within this thread, it looks like there's no such tool available. . http://case.lazaridis.com/wiki/PythonAudit -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Sat, 22 Dec 2007 13:05:23 -0800, Dennis Lee Bieber wrote: > I've never encountered such items > supported by the language. > > OS specific extensions MIGHT supply it... Picky picky... but of course you are right. When I said that programming languages I have used before had facilities to measure memory usage, I meant that the *implementation* had those facilities rather than the language itself. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On 22 Δεκ, 09:09, Fredrik Lundh <[EMAIL PROTECTED]> wrote: [...] > For Python, standard process monitoring tools (combined with a basic > understanding of how dynamic memory allocation works on modern > platforms) are usually sufficient to get a good view of an application's > memory usage patterns. [...] which "standard process monitoring tools" are those? Aren't there any python specific tools (e.g. which list the python modules which use the memory)? . http://case.lazaridis.com/wiki/PythonAudit -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
Steven D'Aprano wrote: >> > Not me. >> >> You're quite knew to this internet thing, aren't you? ;-) > > :-D (hmm. why is that whenever you make some silly last-second addition to a post, you end up making a stupid typo?) >> And things like "how much memory is free in the heap" isn't even a >> meaningful concept on a modern machine, thanks to the wonders of virtual >> memory (especially the overcommitting kind). > > Maybe the memory model used in modern multi-tasking virtual-memory PCs > makes the concept of "free memory" obsolete. Although if so, somebody > should have a quiet word with the author of the Linux free command: > > $ free > total used free sharedbuffers cached > Mem: 1002524 988736 13788 0 7044 98916 > -/+ buffers/cache: 882776 119748 > Swap: 42410803939736 301344 > > (Admittedly that's system-wide memory usage, rather than for a single > process.) the problem isn't that you can get a number, it's that the number you get has no *direct* correlation to the amount of memory your process can actually allocate -- or at least allocate without causing excessive swapping or triggering the OOM killer or otherwise annoying all the other processes on the machine. >> For Python, standard process monitoring tools (combined with a basic >> understanding of how dynamic memory allocation works on modern >> platforms) are usually sufficient to get a good view of an application's >> memory usage patterns. Just run the program under a few different >> scenarios, and see what it does. > > Are you saying that Python programs can't monitor their own memory use? > > I'm happy to accept that "free memory" is not a meaningful concept for a > process in a modern system. That makes sense. But surely it is reasonable > for a process to have an idea of how much memory it has actually used. > Yes? No? unless you do utterly trivial things, a process allocates memory from a lot of different resource pools (i/o buffers, virtual memory buffers, network buffers, graphics resources, etc). there's simply no way for the process itself to know how much memory it uses. if you want to know, ask the operating system. >> If the memory use looks suspicious, >> use standard debugging techniques to locate the problematic area, and >> standard benchmarking techniques to look for unexpected blowups and >> leaks. > > What sort of "standard debugging techniques" work in the absence of any > way (that I know of) to measure memory usage? as I said, use standard process monitoring tools (i.e. "ps" and "top" etc on Unix, the task manager on Windows) takes you a long way. > In Python, standard > debugging techniques usually start with the print statement > but one can't do anything like this: > > # problematic area of code > last = memory() > for i in xrange(100): > x = foo() > if memory() >= last: > print "memory use increased", memory() it doesn't have to be harder than this: # problematic area of code raw_input("before: check memory here") for i in xrange(100): x = foo() raw_input("after: check memory here") on unix, you can also do e.g. os.system("ps ux") or os.system("ps -F -p %d" % os.getpid()) or some variation thereof. > So what are you suggesting is standard? running individual modules/classes/functions under test harnesses, so you can analyze their behaviour under well-known conditions. -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Sat, 22 Dec 2007 08:09:50 +0100, Fredrik Lundh wrote: > Steven D'Aprano wrote: > > > Not me. > > You're quite knew to this internet thing, aren't you? ;-) :-D >> So... how do you measure memory usage in Python? Every programming >> language I've used before (not a huge range, I'll admit) had *some* >> sort of facility to measure memory usage, typically things like: >> >> * how much memory is free in the stack? >> >> * how much memory is free in the heap? >> >> * how big a block does this pointer point to? >> >> * how much memory does this record/struct/object/string use? > > And what languages would that be? I cannot think of a single modern > language that does any of that. Including low-level stuff like C/C++. I didn't actually say they were *modern* languages. E.g. THINK Pascal for Apple Mac, circa 1990. > And things like "how much memory is free in the heap" isn't even a > meaningful concept on a modern machine, thanks to the wonders of virtual > memory (especially the overcommitting kind). Maybe the memory model used in modern multi-tasking virtual-memory PCs makes the concept of "free memory" obsolete. Although if so, somebody should have a quiet word with the author of the Linux free command: $ free total used free sharedbuffers cached Mem: 1002524 988736 13788 0 7044 98916 -/+ buffers/cache: 882776 119748 Swap: 42410803939736 301344 (Admittedly that's system-wide memory usage, rather than for a single process.) > For Python, standard process monitoring tools (combined with a basic > understanding of how dynamic memory allocation works on modern > platforms) are usually sufficient to get a good view of an application's > memory usage patterns. Just run the program under a few different > scenarios, and see what it does. Are you saying that Python programs can't monitor their own memory use? I'm happy to accept that "free memory" is not a meaningful concept for a process in a modern system. That makes sense. But surely it is reasonable for a process to have an idea of how much memory it has actually used. Yes? No? > If the memory use looks suspicious, > use standard debugging techniques to locate the problematic area, and > standard benchmarking techniques to look for unexpected blowups and > leaks. What sort of "standard debugging techniques" work in the absence of any way (that I know of) to measure memory usage? In Python, standard debugging techniques usually start with the print statement, but one can't do anything like this: # problematic area of code last = memory() for i in xrange(100): x = foo() if memory() >= last: print "memory use increased", memory() So what are you suggesting is standard? > For really hard problems, use the "gc" module, instrumenting memory > allocation libraries (e.g. dmalloc), or C/C++-level debuggers. I'm not so much concerned about the really hard problems as I am about the really easy ones. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
Steven D'Aprano wrote: > Not me. You're quite knew to this internet thing, aren't you? ;-) > So... how do you measure memory usage in Python? Every programming > language I've used before (not a huge range, I'll admit) had *some* sort > of facility to measure memory usage, typically things like: > > * how much memory is free in the stack? > > * how much memory is free in the heap? > > * how big a block does this pointer point to? > > * how much memory does this record/struct/object/string use? And what languages would that be? I cannot think of a single modern language that does any of that. Including low-level stuff like C/C++. And things like "how much memory is free in the heap" isn't even a meaningful concept on a modern machine, thanks to the wonders of virtual memory (especially the overcommitting kind). For Python, standard process monitoring tools (combined with a basic understanding of how dynamic memory allocation works on modern platforms) are usually sufficient to get a good view of an application's memory usage patterns. Just run the program under a few different scenarios, and see what it does. If the memory use looks suspicious, use standard debugging techniques to locate the problematic area, and standard benchmarking techniques to look for unexpected blowups and leaks. For really hard problems, use the "gc" module, instrumenting memory allocation libraries (e.g. dmalloc), or C/C++-level debuggers. -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Fri, 21 Dec 2007 14:21:27 +0100, Diez B. Roggisch wrote: >>> So, anyone who hit's on this thread via a search will think >>> >>> a) that there's really no memory leak detection for python b) that >>> this community is not very helpful > > c) That finally people in this forum are smart enough to detect your > flamebait & refuse to comment on it, Ilias... Not me. I didn't (still don't actually) recognise Ilias' name. I was actually thinking: (d) Python is so great that there can never be any memory leaks! but I guess that's probably wishful thinking. So... how do you measure memory usage in Python? Every programming language I've used before (not a huge range, I'll admit) had *some* sort of facility to measure memory usage, typically things like: * how much memory is free in the stack? * how much memory is free in the heap? * how big a block does this pointer point to? * how much memory does this record/struct/object/string use? Unless I've missed something, I don't believe Python does *any* of that. It could be quite useful. The timeit module is good for measuring the time taken for code to run, but as near as I can tell, there's no way to optimize memory use except prematurely. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Dec 21, 3:21 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: [...] Please get serious, Mr.! (and avoid further off-topics) . -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Dec 21, 12:25 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Dec 21, 7:42 pm, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > On Dec 19, 5:40 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > > On Dec 17, 8:41 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > > > How to detect memory leaks of python programms, which run in an > > > > environment like this: > > > > > * Suse Linux 9.3 > > > > * Apache > > > > *mod_python > > > > > The problem occoured after some updates on the infrastructure. It's > > > > most possibly caused by trac and it's dependencies, but several > > > > components of the OS where updated, too. > > > > > Any nice tools which play with the above constellation? > > > > > Thank's for any hints! > > > > No tool available to detect memory leaks for python applications? > > > So, anyone who hit's on this thread via a search will think > > > a) that there's really no memory leak detection for python > > b) that this community is not very helpful > > Comments like (b) will not help your chances one bit in respect of > getting an answer from anyone. [...] I'm really just looking for a low-level python (memory) profiling tool, and thus i'm asking in c.l.p. for experiences, mainly in context of an apache mod_python environment. As to Open Source etc.: http://case.lazaridis.com/wiki/PythonAudit http://case.lazaridis.com/wiki/CoreLiveEval Than you for your reply. . -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
>> So, anyone who hit's on this thread via a search will think >> >> a) that there's really no memory leak detection for python >> b) that this community is not very helpful c) That finally people in this forum are smart enough to detect your flamebait & refuse to comment on it, Ilias... > Comments like (b) will not help your chances one bit in respect of > getting an answer from anyone. > > Maybe you should read: > > http://www.catb.org/~esr/faqs/smart-questions.html > > Two things to note in here. First, choose your forum appropriately and > secondly show some courtesy rather than making accusations against the > community if no one answers. > > If you want to see perhaps how you might be viewed by the open source > community when you make such a comment, perhaps also watch: > > http://video.google.com/videoplay?docid=-4216011961522818645 > > Now, since you think this is a Trac problem, why don't you go ask on > the Trac mailing list. > > http://groups.google.com/group/trac-users?lnk=li > > Even a search of that forum will most likely yield previous > discussions about growing memory use of Trac as a result of things > like Python wrappers for Subversion or certain database adapters. It > may be a case of using a different version, or in some cases > configuration of your hosting environment, if using Apache, to recycle > Apache child processes after a set number of requests so as to restore > process sizes back to a low level. > > So, do some research first in the correct places and then perhaps ask > any additional questions in the correct place also. Graham, I'm not sure how long you have been around here - but googling for Ilias in general and specificly in this group will reveal that he often posts spiteful & inflammatory messages and has a tendency to get cross with open source projects. It's debatable if he can be called a troll - but he surely is a nuisance best let alone, so he doesn't gain traction. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Dec 21, 7:42 pm, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > On Dec 19, 5:40 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > > > > On Dec 17, 8:41 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > > > How to detect memory leaks of python programms, which run in an > > > environment like this: > > > > * Suse Linux 9.3 > > > * Apache > > > *mod_python > > > > The problem occoured after some updates on the infrastructure. It's > > > most possibly caused by trac and it's dependencies, but several > > > components of the OS where updated, too. > > > > Any nice tools which play with the above constellation? > > > > Thank's for any hints! > > > No tool available to detect memory leaks for python applications? > > So, anyone who hit's on this thread via a search will think > > a) that there's really no memory leak detection for python > b) that this community is not very helpful Comments like (b) will not help your chances one bit in respect of getting an answer from anyone. Maybe you should read: http://www.catb.org/~esr/faqs/smart-questions.html Two things to note in here. First, choose your forum appropriately and secondly show some courtesy rather than making accusations against the community if no one answers. If you want to see perhaps how you might be viewed by the open source community when you make such a comment, perhaps also watch: http://video.google.com/videoplay?docid=-4216011961522818645 Now, since you think this is a Trac problem, why don't you go ask on the Trac mailing list. http://groups.google.com/group/trac-users?lnk=li Even a search of that forum will most likely yield previous discussions about growing memory use of Trac as a result of things like Python wrappers for Subversion or certain database adapters. It may be a case of using a different version, or in some cases configuration of your hosting environment, if using Apache, to recycle Apache child processes after a set number of requests so as to restore process sizes back to a low level. So, do some research first in the correct places and then perhaps ask any additional questions in the correct place also. Graham -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Dec 19, 5:40 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > On Dec 17, 8:41 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > > > How to detect memory leaks of python programms, which run in an > > environment like this: > > > * Suse Linux 9.3 > > * Apache > > * mod_python > > > The problem occoured after some updates on the infrastructure. It's > > most possibly caused by trac and it's dependencies, but several > > components of the OS where updated, too. > > > Any nice tools which play with the above constellation? > > > Thank's for any hints! > > No tool available to detect memory leaks for python applications? So, anyone who hit's on this thread via a search will think a) that there's really no memory leak detection for python b) that this community is not very helpful > > > context: > > >http://dev.lazaridis.com/base/ticket/148 -- http://mail.python.org/mailman/listinfo/python-list
Re: Detecting memory leaks on apache, mod_python
On Dec 17, 8:41 am, Ilias Lazaridis <[EMAIL PROTECTED]> wrote: > How to detect memory leaks of python programms, which run in an > environment like this: > > * Suse Linux 9.3 > * Apache > * mod_python > > The problem occoured after some updates on the infrastructure. It's > most possibly caused by trac and it's dependencies, but several > components of the OS where updated, too. > > Any nice tools which play with the above constellation? > > Thank's for any hints! No tool available to detect memory leaks for python applications? > context: > > http://dev.lazaridis.com/base/ticket/148 -- http://mail.python.org/mailman/listinfo/python-list
Detecting memory leaks on apache, mod_python
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure. It's most possibly caused by trac and it's dependencies, but several components of the OS where updated, too. Any nice tools which play with the above constellation? Thank's for any hints! context: http://dev.lazaridis.com/base/ticket/148 -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On Mar 9, 7:09 pm, "Danilo" <[EMAIL PROTECTED]> wrote: > On 8 Mrz., 22:23, [EMAIL PROTECTED] wrote: > > > > > On Mar 9, 12:02 am, "Danilo" <[EMAIL PROTECTED]> wrote: > > > > On 8 Mrz., 12:18, [EMAIL PROTECTED] wrote: > > > > > On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote: > > > > > > Hi there, > > > > > > is it possible to create a rewrite rule to send every server-request > > > > > to the directory /py? But only if the file does not exists on the > > > > > server. > > > > > > This is mymod_pythonsection of the apache config-file. > > > > > > > > > > > SetHandler python-program > > > > > PythonHandler django.core.handlers.modpython > > > > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > > > > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > > > > > PythonDebug Off > > > > > > > > > > For the more general case of where a HTTP 404 error would otherwise be > > > > returned, indicating that a resource could not be found, as opposed to > > > > an actual physical file, you can just use: > > > > > ErrorDocument 404 /py > > > > > This would be simpler than using mod_rewrite. I can't remember though > > > > whether the handler when triggered in this case can change the > > > > response status to something other than 404. > > > > > You could use mod_rewrite if you really must, but not sure how it > > > > would interact with virtual resources managed by some handler where no > > > > actual file exists. To be practical you would probably want to > > > > restrict the scope of mod_rewrite to specific contexts. > > > > > Quoting an example from very good book "The Definitive Guide to Apache > > > > mod_rewrite", you can do something similar to: > > > > > RewriteEngine On > > > > # If its not here ... > > > > RewriteCond %{REQUEST_FILENAME} !-f > > > > RewriteCond %{REQUEST_FILENAME} !-d > > > > # Look here instead ... > > > > RewriteRule ^/images/(.*) /pics/$1 [PT] > > > > > In this case it is causing lookups for images to be made in two > > > > places, but your case wouldn't be much different. > > > > > Graham > > > > The rewrite rule works, but now every request ist send to /py. > > > This is my .conf: > > > > > > > DocumentRoot /var/www/mydomain.com/htdocs > > > ServerName mydomain.com > > > ServerAliaswww.mydomain.com > > > > > > > SetHandler python-program > > > PythonHandler django.core.handlers.modpython > > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + > > > sys.path" > > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > > > PythonDebug Off > > > > > > > RewriteEngine On > > > # If its not here... > > > RewriteCond %{REQUEST_FILENAME} !-f > > > RewriteCond %{REQUEST_FILENAME} !-d > > > # Look here instead... > > > RewriteRule (.*) /py$1 [PT] > > > > ErrorLog /var/www/mydomain.com/logs/error.log > > > CustomLog /var/www/mydomain.com/logs/access.log common > > > > > > > Any ideas what is wrong? > > > I did say you would probably need to restrict the scope of the > > mod_rewrite rule to a specific context. In particular, put it inside > > of a Directory directive corresponding to the file system directory > > where your files live. Where you have it as the moment, > > REQUEST_FILENAME probably will not resolve to anything as Apache > > hasn't yet matched it to the filesystem. Thus: > > > > > > RewriteEngine On > > # If its not here... > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteCond %{REQUEST_FILENAME} !-d > > # Look here instead... > > RewriteRule (.*) /py$1 [PT] > > > > > > Graham > > Thank you. > > the RewriteCond just needs the absolute path: > > RewriteEngine On > # If its not here... > RewriteCond /var/www/btsgroup.de/htdocs/%{REQUEST_FILENAME} !-f > RewriteCond /var/www/btsgroup.de/htdocs/%{REQUEST_FILENAME} !-d > # Look here instead... > RewriteRule (.*) /py$1 [PT] Doing that would probably be considered bad practice. I think the problem was I neglected to mention you would have to change your RewriteRule to add a slash when used in Directory directive. Ie., use: RewriteEngine On # If its not here... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Look here instead... RewriteRule (.*) /py/$1 [PT] Note the slash after /py. This works for me when I test it. Graham -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On 8 Mrz., 22:23, [EMAIL PROTECTED] wrote: > On Mar 9, 12:02 am, "Danilo" <[EMAIL PROTECTED]> wrote: > > > > > On 8 Mrz., 12:18, [EMAIL PROTECTED] wrote: > > > > On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote: > > > > > Hi there, > > > > > is it possible to create a rewrite rule to send every server-request > > > > to the directory /py? But only if the file does not exists on the > > > > server. > > > > > This is my mod_python section of the apache config-file. > > > > > > > > > SetHandler python-program > > > > PythonHandler django.core.handlers.modpython > > > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > > > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > > > > PythonDebug Off > > > > > > > > For the more general case of where a HTTP 404 error would otherwise be > > > returned, indicating that a resource could not be found, as opposed to > > > an actual physical file, you can just use: > > > > ErrorDocument 404 /py > > > > This would be simpler than using mod_rewrite. I can't remember though > > > whether the handler when triggered in this case can change the > > > response status to something other than 404. > > > > You could use mod_rewrite if you really must, but not sure how it > > > would interact with virtual resources managed by some handler where no > > > actual file exists. To be practical you would probably want to > > > restrict the scope of mod_rewrite to specific contexts. > > > > Quoting an example from very good book "The Definitive Guide to Apache > > > mod_rewrite", you can do something similar to: > > > > RewriteEngine On > > > # If its not here ... > > > RewriteCond %{REQUEST_FILENAME} !-f > > > RewriteCond %{REQUEST_FILENAME} !-d > > > # Look here instead ... > > > RewriteRule ^/images/(.*) /pics/$1 [PT] > > > > In this case it is causing lookups for images to be made in two > > > places, but your case wouldn't be much different. > > > > Graham > > > The rewrite rule works, but now every request ist send to /py. > > This is my .conf: > > > > > DocumentRoot /var/www/mydomain.com/htdocs > > ServerName mydomain.com > > ServerAliaswww.mydomain.com > > > > > SetHandler python-program > > PythonHandler django.core.handlers.modpython > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > > PythonDebug Off > > > > > RewriteEngine On > > # If its not here... > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteCond %{REQUEST_FILENAME} !-d > > # Look here instead... > > RewriteRule (.*) /py$1 [PT] > > > ErrorLog /var/www/mydomain.com/logs/error.log > > CustomLog /var/www/mydomain.com/logs/access.log common > > > > > Any ideas what is wrong? > > I did say you would probably need to restrict the scope of the > mod_rewrite rule to a specific context. In particular, put it inside > of a Directory directive corresponding to the file system directory > where your files live. Where you have it as the moment, > REQUEST_FILENAME probably will not resolve to anything as Apache > hasn't yet matched it to the filesystem. Thus: > > > > RewriteEngine On > # If its not here... > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > # Look here instead... > RewriteRule (.*) /py$1 [PT] > > > > Graham Thank you. the RewriteCond just needs the absolute path: RewriteEngine On # If its not here... RewriteCond /var/www/btsgroup.de/htdocs/%{REQUEST_FILENAME} !-f RewriteCond /var/www/btsgroup.de/htdocs/%{REQUEST_FILENAME} !-d # Look here instead... RewriteRule (.*) /py$1 [PT] Thanks dan -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On Mar 9, 12:02 am, "Danilo" <[EMAIL PROTECTED]> wrote: > On 8 Mrz., 12:18, [EMAIL PROTECTED] wrote: > > > > > On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote: > > > > Hi there, > > > > is it possible to create a rewrite rule to send every server-request > > > to the directory /py? But only if the file does not exists on the > > > server. > > > > This is my mod_python section of the apache config-file. > > > > > > > SetHandler python-program > > > PythonHandler django.core.handlers.modpython > > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > > > PythonDebug Off > > > > > > For the more general case of where a HTTP 404 error would otherwise be > > returned, indicating that a resource could not be found, as opposed to > > an actual physical file, you can just use: > > > ErrorDocument 404 /py > > > This would be simpler than using mod_rewrite. I can't remember though > > whether the handler when triggered in this case can change the > > response status to something other than 404. > > > You could use mod_rewrite if you really must, but not sure how it > > would interact with virtual resources managed by some handler where no > > actual file exists. To be practical you would probably want to > > restrict the scope of mod_rewrite to specific contexts. > > > Quoting an example from very good book "The Definitive Guide to Apache > > mod_rewrite", you can do something similar to: > > > RewriteEngine On > > # If its not here ... > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteCond %{REQUEST_FILENAME} !-d > > # Look here instead ... > > RewriteRule ^/images/(.*) /pics/$1 [PT] > > > In this case it is causing lookups for images to be made in two > > places, but your case wouldn't be much different. > > > Graham > > The rewrite rule works, but now every request ist send to /py. > This is my .conf: > > > DocumentRoot /var/www/mydomain.com/htdocs > ServerName mydomain.com > ServerAliaswww.mydomain.com > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > PythonDebug Off > > > RewriteEngine On > # If its not here... > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > # Look here instead... > RewriteRule (.*) /py$1 [PT] > > ErrorLog /var/www/mydomain.com/logs/error.log > CustomLog /var/www/mydomain.com/logs/access.log common > > > Any ideas what is wrong? I did say you would probably need to restrict the scope of the mod_rewrite rule to a specific context. In particular, put it inside of a Directory directive corresponding to the file system directory where your files live. Where you have it as the moment, REQUEST_FILENAME probably will not resolve to anything as Apache hasn't yet matched it to the filesystem. Thus: RewriteEngine On # If its not here... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Look here instead... RewriteRule (.*) /py$1 [PT] Graham -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On 8 Mrz., 12:18, [EMAIL PROTECTED] wrote: > On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > is it possible to create a rewrite rule to send every server-request > > to the directory /py? But only if the file does not exists on the > > server. > > > This is my mod_python section of the apache config-file. > > > > > SetHandler python-program > > PythonHandler django.core.handlers.modpython > > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > > PythonDebug Off > > > > For the more general case of where a HTTP 404 error would otherwise be > returned, indicating that a resource could not be found, as opposed to > an actual physical file, you can just use: > > ErrorDocument 404 /py > > This would be simpler than using mod_rewrite. I can't remember though > whether the handler when triggered in this case can change the > response status to something other than 404. > > You could use mod_rewrite if you really must, but not sure how it > would interact with virtual resources managed by some handler where no > actual file exists. To be practical you would probably want to > restrict the scope of mod_rewrite to specific contexts. > > Quoting an example from very good book "The Definitive Guide to Apache > mod_rewrite", you can do something similar to: > > RewriteEngine On > # If its not here ... > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > # Look here instead ... > RewriteRule ^/images/(.*) /pics/$1 [PT] > > In this case it is causing lookups for images to be made in two > places, but your case wouldn't be much different. > > Graham The rewrite rule works, but now every request ist send to /py. This is my .conf: DocumentRoot /var/www/mydomain.com/htdocs ServerName mydomain.com ServerAlias www.mydomain.com SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE myapp.settings PythonDebug Off RewriteEngine On # If its not here... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Look here instead... RewriteRule (.*) /py$1 [PT] ErrorLog /var/www/mydomain.com/logs/error.log CustomLog /var/www/mydomain.com/logs/access.log common Any ideas what is wrong? -- http://mail.python.org/mailman/listinfo/python-list
Re: Configuration: Apache + mod_python
On Mar 8, 9:50 pm, "Danilo" <[EMAIL PROTECTED]> wrote: > Hi there, > > is it possible to create a rewrite rule to send every server-request > to the directory /py? But only if the file does not exists on the > server. > > This is my mod_python section of the apache config-file. > > > SetHandler python-program > PythonHandler django.core.handlers.modpython > PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" > SetEnv DJANGO_SETTINGS_MODULE myapp.settings > PythonDebug Off > For the more general case of where a HTTP 404 error would otherwise be returned, indicating that a resource could not be found, as opposed to an actual physical file, you can just use: ErrorDocument 404 /py This would be simpler than using mod_rewrite. I can't remember though whether the handler when triggered in this case can change the response status to something other than 404. You could use mod_rewrite if you really must, but not sure how it would interact with virtual resources managed by some handler where no actual file exists. To be practical you would probably want to restrict the scope of mod_rewrite to specific contexts. Quoting an example from very good book "The Definitive Guide to Apache mod_rewrite", you can do something similar to: RewriteEngine On # If its not here ... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Look here instead ... RewriteRule ^/images/(.*) /pics/$1 [PT] In this case it is causing lookups for images to be made in two places, but your case wouldn't be much different. Graham -- http://mail.python.org/mailman/listinfo/python-list
Configuration: Apache + mod_python
Hi there, is it possible to create a rewrite rule to send every server-request to the directory /py? But only if the file does not exists on the server. This is my mod_python section of the apache config-file. SetHandler python-program PythonHandler django.core.handlers.modpython PythonPath "['/var/www/mydomain.com/htdocs/py'] + sys.path" SetEnv DJANGO_SETTINGS_MODULE myapp.settings PythonDebug Off Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache & mod_python
Maxim Sloyko wrote: > m.banaouas wrote: > > > Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent > > versions) without facing any known major issue ? Only that to use Apache 2.2 you must have mod_python 3.2.10 or later, older versions of mod_python do not work with the more recent version of Apache. > Works fine for me. > The only "known major issue" you can face is general non-threadsafety > of Python interpreter. So, if you are using Apache MPM, you have to > allow for it, or use framework that does it for you. You answer here is a bit misleading. There are no issues with the thread safety of the Python interpreter per-se. However, as with any Python application, whether mod_python is used or not, if multiple threads are being used your application code may have to be written so as to cope with access to code/data from multiple threads at the same time. This is not anything unique to mod_python. Whether this will be an issue or not is dependent on which Apache MPM is used, not that the Apache MPM is used as one will always be used. The specific Apache MPMs where multithreading has to be taken into consideration are "winnt" on Windows platforms and "worker" on UNIX platforms. What this all means is that when these MPMs are used there can be concurrent request handlers executing in distinct threads within the same Apache processes. Thus, where common data is accessed, it has to be adequately protected. For further details on the Apache/mod_python process/interpreter/thread model, see: http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel That said, there are sometimes threading issues with mod_python but it is more to do with the fact that mod_python can use multiple interpreter instances within a single process. Also, the problems are not a problem in mod_python, but result from third party C modules for Python being used which take the simple path of using the simplified thread API for working with the GIL. Such modules often will not work properly when used from secondary Python interpreter instances. In these cases it is a simple matter of telling mod_python to handle requests which are dependent on those modules within the main Python interpreter, ie., the very first one which gets created. Where third party C modules use the full thread API for Python properly, it doesn't matter which interpreter instance they are used from. Graham -- http://mail.python.org/mailman/listinfo/python-list
Re: apache & mod_python
m.banaouas wrote: > Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent > versions) without facing any known major issue ? Works fine for me. The only "known major issue" you can face is general non-threadsafety of Python interpreter. So, if you are using Apache MPM, you have to allow for it, or use framework that does it for you. -- http://mail.python.org/mailman/listinfo/python-list
apache & mod_python
Hi, bonjour, witch versions are suitable to use for apache & mod_python ? Can i install and use "Apache 2.2.3" & "mod_python 3.2.10" (most recent versions) without facing any known major issue ? thanks for any help. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
please ignore that last message, the instructions on that webpage worked, it was my fault. Thanks, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
Hi Graham, thank you for that link but it didn't help. I've followed the instructions, yet In the 'basic-content-handler' section, after getting to the point where it says to add this to the main Apache configuration file: AllowOverride FileInfo I replaced /some/directory with the correct directory and restarted apache2 and stilll get the same response - firwfox asks to save the response to a file. Does it matter where in the apache2 configuration file I've located these 3 lines? I've just added them at the end, just before the last line: Thank you in advance, Ido. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
Ido Yehieli wrote: > Thank you for your response, > but I think it's not it - that didn't make any difference. Suggest you read: http://www.dscpl.com.au/articles/modpython-001.html It contains helpful hints for getting a basic handler working in mod_python. If you can get that working, then try something harder. You are also better off asking mod_python questions on the mod_python mailing list. See www.modpython.org home page for how to get on mailing list. Graham -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
Thank you for your response, but I think it's not it - that didn't make any difference. -- http://mail.python.org/mailman/listinfo/python-list
Re: apache mod_python problem
Ido Yehieli schrieb: > [...] > Anyone has any idea as to what went wrong? > [...] If you compiled mod_python as a Dynamic Shared Object (DSO) you have to tell Apache to load that module. For example like this: LoadModule python_module libexec/mod_python.so See the mod_python documentation, especially the Configuring Apache section: http://modpython.org/live/current/doc-html/inst-apacheconfig.html Bye, Dennis -- http://mail.python.org/mailman/listinfo/python-list
apache mod_python problem
Hi all, I have succesfully installed apache+mod_python (ubuntu 5.10 (Breezy), libapache2-mod-python2.4 Version: 3.1.3-3ubuntu1, apache2 Version: 2.0.54-5ubuntu4, python2.4 Version: 2.4.2-1). It seems apache and everything functions fine. I tried to run the example application from the mod_python site (http://www.modpython.org/examples/psp_site.tgz) by decompressing the tgz file in a place where apache can find it, and then access it via mozilla firefox (simply http://127.0.0.1/psp_site/ where 'psp-site' is the name of the directory.) However, instead of running the index.py page like it shoud, I just get the list of files, as in: Index of /psp_site Icon NameLast modified Size Description[DIR] Parent Directory - [TXT] PyFontify.py15-Feb-2006 23:02 4.3K [DIR] images/ 15-Feb-2006 23:02- [TXT] index.py15-Feb-2006 23:02 3.4K [ ] index.pyc 15-Feb-2006 23:02 4.1K [TXT] py2html.py 15-Feb-2006 23:02 13K [DIR] styles/ 15-Feb-2006 23:02- [DIR] templates/ 15-Feb-2006 23:02- [TXT] view.py 15-Feb-2006 23:02 726 and clicking any of the .py files just opens the 'open/save' menu. The .htaccess file contains: SetHandler mod_python PythonHandler mod_python.publisher PythonDebug On everything is exactly as it is on "http://www.modpython.org/examples/";, I didn't change anything. Anyone has any idea as to what went wrong? Thank you in advance, Ido Yehieli. -- http://mail.python.org/mailman/listinfo/python-list
Re: problem running a python script using apache,mod_python on linux
Neha, > I have made the required changes to the httpd.conf file > *** > LoadModule python_module /home/ngupta/Apache2/modules/mod_python.so Did you also add the line: AddModule mod_python.c > DocumentRoot "/home/ngupta/Apache2/htdocs" > > > AllowOverride FileInfo > > > *** > I m using a .htaccess file placed under Apache2/htdocs/test/ > The .htaccess file has the following code > ** > AddHandler mod_python .py > PythonHandler mptest > PythonDebug On > ** I didn't see anything else that jumps out. Brad -- http://mail.python.org/mailman/listinfo/python-list
problem running a python script using apache,mod_python on linux
hi, i m trying to integrate python with apache on linux.For this i m using mod_python. I dont see any problem with the versions of python,apache and mod_python i m using. the versions i m using are apache version2. mod_python v3.1.14 python2.4 The problem is,when i m running my python script,after starting apache ,it is showing me the code it has. My error_log is showing the following message [Tue Oct 18 19:01:06 2005] [notice] Apache/2.0.55 (Unix) mod_python/3.1.4 Python/2.4.2 configured -- resuming normal operations [Tue Oct 18 19:01:06 2005] [info] Server built: Oct 17 2005 13:07:52 [Tue Oct 18 19:01:06 2005] [debug] prefork.c(956): AcceptMutex: sysvsem (default: sysvsem) the access_log is showing this message: 127.0.0.1 - - [18/Oct/2005:19:01:14 +0530] "GET /apache_pb.gif HTTP/1.1" 200 2326 127.0.0.1 - - [18/Oct/2005:19:01:19 +0530] "GET /test/mptest.py HTTP/1.1" 200 110 from the python script,i m returning an apache.OK ,so i think it goin on fine,as i m getting 200i.e the hhtp processing is goin on fine. I have made the required changes to the httpd.conf file *** LoadModule python_module /home/ngupta/Apache2/modules/mod_python.so DocumentRoot "/home/ngupta/Apache2/htdocs" AllowOverride FileInfo *** I m using a .htaccess file placed under Apache2/htdocs/test/ The .htaccess file has the following code ** AddHandler mod_python .py PythonHandler mptest PythonDebug On ** where mptest is python script and is as follows ** from mod_python import apache def handler(req): req.send_http_header() req.write("Hello") return apache.OK ** so if anyone knows where the problem lies ,please tell me. thanks. Neha gupta -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache mod_python
Dan <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > My question is, how mature/stable is mod_python? Is it suitable for a > production environment? The documentation is a bit lacking, and I've I use mod_python for all my web stuff, including several live production sites - no problems so far. Admittedly, I don't use anything too complicated - usually just the handler and publisher syntax and a little bit of authentication. Plus MySQL on the back end. >From what I've been told, the one gotcha is that you want to make sure that different on-server users aren't sharing the same copy of mod_python, since they'll have a shared context. Which would only a problem where you're running a server open for lots of people to set up their own pages. I own all the servers being used so it's not an issue. -- http://mail.python.org/mailman/listinfo/python-list
Re: Apache mod_python
Dan wrote: I've been writing a server application in Python. The app listens on a socket and interfaces to a database. Now I'd like to write a web application to also access the database. It seems natural to use Python. I've installed mod_python (Debian libapache2-mod-python2.3, mod_python 3.1.3-4). My question is, how mature/stable is mod_python? Is it suitable for a production environment? The documentation is a bit lacking, and I've found some errors in the demo example where it looks like the link should work, but it doesn't. (Could well be something I'm doing.). I've also noted that there's still work being done on it. Hi Dan mod_python is quite mature and stable and usable in a production environment. However it is fairly low level and a lot of people like to add another framework on top of it. If you point out the documentation problems you're having then people can say whether you're making a mistake or there is really an error David -- http://mail.python.org/mailman/listinfo/python-list
Apache mod_python
I've been writing a server application in Python. The app listens on a socket and interfaces to a database. Now I'd like to write a web application to also access the database. It seems natural to use Python. I've installed mod_python (Debian libapache2-mod-python2.3, mod_python 3.1.3-4). My question is, how mature/stable is mod_python? Is it suitable for a production environment? The documentation is a bit lacking, and I've found some errors in the demo example where it looks like the link should work, but it doesn't. (Could well be something I'm doing.). I've also noted that there's still work being done on it. Thanks. Dan -- http://mail.python.org/mailman/listinfo/python-list
Apache/mod_python & MySQLdb
AIUI, global variables are supposed to be preserved within each Apache thread/prcoess. However, I'm importing and using MySQLdb within a class in a separate module, which is in turn imported and used within a _function (ie. not "published"). So, AFAICT, it's not supposed to be preseved. But unless I specifically close() the database connection, it gets stranded and I eventually run out of connections, even if I del the connection and cursor objects. What gives? What happened to GC? Also, is there an easy way to run pychecker on mod_python scripts? It fails since _apache doesn't exist outside of Apache regards, Confused & tired of PHP. -- http://mail.python.org/mailman/listinfo/python-list