On Apr 4, 2:24 pm, "Jared Dobson" <[EMAIL PROTECTED]> wrote: > Hey Graham, > > Thanks for you reply. :-) is this your site:http://www.dscpl.com.au/?If > so you know all about mod_python, and I really appreaciate you helping me > out. :-)
The following is also my site: http://www.modwsgi.org If you get totally frustrated with mod_python, perhaps try using it instead. ;-) > My project is under the /home directory so i added it to the PythonPath. Can you post output from running 'ls -las /home'? > I tried the following and it all worked good. > > [EMAIL PROTECTED] ~]# sudo -H -u apache python2.5 > Python 2.5.2 (r252:60911, Apr 3 2008, 15:18:20) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import django.core.handlers.modpython > >>> dir(django.core.handlers.modpython) > > ['BaseHandler', 'ModPythonHandler', 'ModPythonRequest', '__builtins__', > '__doc__', '__file__', '__name__', 'datastructures', 'dispatcher', > 'force_unicode', 'handler', 'http', 'os', 'pformat', 'signals', 'smart_str'] > > [EMAIL PROTECTED] ~]# sudo -H -u apache python2.5 > Python 2.5.2 (r252:60911, Apr 3 2008, 15:18:20) > [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2 > Type "help", "copyright", "credits" or "license" for more information.>>> > import sys > >>> sys.path > > ['', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', > '/usr/local/lib/python2.5/plat-linux2', '/usr/local/lib/python2.5/lib-tk', > '/usr/local/lib/python2.5/lib-dynload', > '/usr/local/lib/python2.5/site-packages'] > >>> sys.path = sys.path + ['/home/'] What about when you prepend it: sys.path = ['/home/'] + sys.path This would match what you were doing in mod_python: PythonPath "['/home/'] + sys.path" The order is important as was trying to see whether you might have some conflicting directory in '/home'. Graham > >>> sys.path > > ['', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', > '/usr/local/lib/python2.5/plat-linux2', '/usr/local/lib/python2.5/lib-tk', > '/usr/local/lib/python2.5/lib-dynload', > '/usr/local/lib/python2.5/site-packages', '/home/'] > >>> import django.core.handlers.modpython > >>> dir(django) > > ['VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__path__', > 'core', 'dispatch', 'get_version', 'http', 'utils'] > >>> dir(django.core.handlers.modpython) > > ['BaseHandler', 'ModPythonHandler', 'ModPythonRequest', '__builtins__', > '__doc__', '__file__', '__name__', 'datastructures', 'dispatcher', > 'force_unicode', 'handler', 'http', 'os', 'pformat', 'signals', 'smart_str'] > > Sorry about the Python2.3 comment, I first used it as it was the default > python version for this distro.(CentOS 4.6) > I installed Python2.5 and rebuilt / installed ModPython seeing if that would > make some crazy difference. But no dice. > > Anyways thanks again for your help. > > Thanks, > Jared Dobson > > On Thu, Apr 3, 2008 at 5:24 PM, Graham Dumpleton <[EMAIL PROTECTED]> > wrote: > > > > > On Apr 4, 8:37 am, Jared Dobson <[EMAIL PROTECTED]> wrote: > > > Hello, > > > > Have anyone ever seen this error i'm on the latest svn trunk for > > > django, I have been searching the mailing list to find an answer. > > > > Mod_python is working because i mod_python.testhandler for the same > > > apache config section works great. > > > <Location "/test"> > > > PythonPath "['/home/'] + sys.path" > > > What directories are under '/home' and why would you want to add it to > > the Python module search path? > > > > SetHandler python-program > > > PythonHandler mod_python.testhandler > > > SetEnv DJANGO_SETTINGS_MODULE rvs_manager.settings > > > PythonDebug On > > > </Location> > > > > Here is the sys.path from mod_python.testhandler: > > > > Python sys.path /home/ > > > /usr/local/lib/python25.zip > > > /usr/local/lib/python2.5 > > > /usr/local/lib/python2.5/plat-linux2 > > > /usr/local/lib/python2.5/lib-tk > > > /usr/local/lib/python2.5/lib-dynload > > > /usr/local/lib/python2.5/site-packages > > > > Also when i run sudo -u apache python(or python2.5) and import django: > > > <module 'django' from '/usr/local/lib/python2.5/site-packages/django/ > > > __init__.pyc'> > > > But what do you get if you import 'django.core.handlers.modpython' > > from command line Python? > > > What is PYTHONPATH environment variable in your personal user account? > > > If you add '/home' to PYTHONPATH and try importing > > 'django.core.handlers.modpython', does it work? Verify that '/home' is > > in sys.path when doing this from command line. > > > Do all the above but use 'sudo -H -u apache python2.5'. > > > > (and python2.3 for the other one.) > > > How does Python 2.3 come in to this? > > > Graham > > > > Here's the error: > > > > MOD_PYTHON ERROR > > > ProcessId: 20141 > > > Interpreter: 'localhost.localdomain' > > > ServerName: 'localhost.localdomain' > > > DocumentRoot: '/var/www/html' > > > URI: '/test/' > > > Location: '/test' > > > Directory: None > > > Filename: '/var/www/html/test' > > > PathInfo: '/' > > > Phase: 'PythonHandler' > > > Handler: 'django.core.handlers.modpython' > > > Traceback (most recent call last): > > > File "/usr/local/lib/python2.5/site-packages/mod_python/ > > > importer.py", line 1537, in HandlerDispatch > > > default=default_handler, arg=req, silent=hlist.silent) > > > File "/usr/local/lib/python2.5/site-packages/mod_python/ > > > importer.py", line 1202, in _process_target > > > module = import_module(module_name, path=path) > > > File "/usr/local/lib/python2.5/site-packages/mod_python/ > > > importer.py", line 304, in import_module > > > return __import__(module_name, {}, {}, ['*']) > > > ImportError: No module named django.core.handlers.modpython > > > > Thanks in advance for any advice or tips or if there is an some emails > > > that already cover this. > > > > Thanks, > > > Jared --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---