Hi Robert,

I had quite the same problem, it's been solved by setting 
DJANGO_SETTINGS_MODULE to "settings" instead of "syslog.settings" in 
<Location>.

My current apache2.conf file sets handler to "python-program" instead of 
"mod_python", you can also try it that way.

Hope this helps,
Anthony.


stereoit wrote:
> Hi, I'm having problem with mod_python.
>   
> EnvironmentError: Could not import settings 'syslog.settings' (Is it
> on sys.path? Does it have syntax errors?): No module named settings
> <<<<
>
> I've developed small app for viewing syslog messages and it runs fine
> with following commands:
>
> cd /srv/code/syslog/
> export DJANGO_SETTINGS_MODULE=syslog.settings
> export PYTHONPATH=/srv/code/
> /srv/code/python/bin/python manage.py runserver
>
> I then tried to follow http://www.djangoproject.com/documentation/modpython/
> but I do not understand the concept of mysite and projects. Anyway
> here is what is in my virtualhost:
>
> <Location "/">
>                 SetHandler mod_python
>                 PythonHandler django.core.handlers.modpython
>                 SetEnv DJANGO_SETTINGS_MODULE syslog.settings
>                 PythonPath "['/srv/code'] + sys.path"
>                 PythonDebug On
> </Location>
>
>
> Additional info:
>
> ls /srv/code/syslog/
> accounts  filters  frontend  __init__.py  __init__.pyc  manage.py
> media  settings.py  settings.pyc  site_media  templates  urls.py
> urls.pyc
>
> Since this is running on RedHat4 I downloaded and compiled python
> 2.4.4 with
> ./configure --prefix=/srv/code/python/
> mod_python with:
> ./configure --with-python=/srv/code/python/bin/python
> and copied django to
> cp -r django/ /srv/code/python/lib/python2.4/site-packages/
>
> I can run following just fine:
> $ export PYTHONPATH=/srv/code/
> $ /srv/code/python/bin/python
> Python 2.4.4 (#1, Jul 30 2007, 11:43:39)
> [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>   
>>>> from django.core.handlers import modpython
>>>> from syslog import settings
>>>>
>>>>         
>
> I made sure everything is readable by chmod o+r -R syslog
>
> Am I missing something?
>
> Complete error listing:
>
> MOD_PYTHON ERROR
>
> ProcessId:      19772
> Interpreter:    'syslog.telecom.dhl.com'
>
> ServerName:     'syslog.telecom.dhl.com'
> DocumentRoot:   '/srv/www/syslog.telecom.dhl.com/htdocs'
>
> URI:            '/'
> Location:       '/'
> Directory:      None
> Filename:       '/srv/www/syslog.telecom.dhl.com/htdocs/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>   File "/srv/code/python/lib/python2.4/site-packages/mod_python/
> importer.py", line 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "/srv/code/python/lib/python2.4/site-packages/mod_python/
> importer.py", line 1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File "/srv/code/python/lib/python2.4/site-packages/mod_python/
> importer.py", line 1128, in _execute_target
>     result = object(arg)
>
>   File "/srv/code/python/lib/python2.4/site-packages/django/core/
> handlers/modpython.py", line 177, in handler
>     return ModPythonHandler()(req)
>
>   File "/srv/code/python/lib/python2.4/site-packages/django/core/
> handlers/modpython.py", line 145, in __call__
>     self.load_middleware()
>
>   File "/srv/code/python/lib/python2.4/site-packages/django/core/
> handlers/base.py", line 22, in load_middleware
>     for middleware_path in settings.MIDDLEWARE_CLASSES:
>
>   File "/srv/code/python/lib/python2.4/site-packages/django/conf/
> __init__.py", line 28, in __getattr__
>     self._import_settings()
>
>   File "/srv/code/python/lib/python2.4/site-packages/django/conf/
> __init__.py", line 55, in _import_settings
>     self._target = Settings(settings_module)
>
>   File "/srv/code/python/lib/python2.4/site-packages/django/conf/
> __init__.py", line 83, in __init__
>     raise EnvironmentError, "Could not import settings '%s' (Is it on
> sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
> e)
>
> EnvironmentError: Could not import settings 'syslog.settings' (Is it
> on sys.path? Does it have syntax errors?): No module named settings
>
>
> >
>   


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to