Easiest fix is to run lighttpd on a different port and hand the request from apache to lightpd with mod_proxy
Dont' need to worry about mod_python then, and it's faster. On 01/08/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > > > Read my comments at: > > > http://groups.google.com/group/django-users/browse_frm/thread/24deb095a2b2e450/1c982558d464017a > > The problem is caused by fact that manage.py effectively adds parent > directory and directory of site (by virtue of it being current working > directory). Thus it allows these things. To fix you need to also add > site directory to PythonPath. > > Graham > > On Aug 1, 10:18 pm, stereoit <[EMAIL PROTECTED]> wrote: > > Well, problem was (of course) on my side. After struggling with this > > problem for a day or two I just opened python on my laptop and typed > > import syslog > > > > and it worked, so there is standard python module syslog included > > which of course does not have settings. So renaming the project to > > syslogviewer solved the problem. So far mod_python works ok. > > > > so final http config is as this: > > > > <Location "/"> > > SetHandler python-program > > PythonHandler django.core.handlers.modpython > > SetEnv DJANGO_SETTINGS_MODULE syslogviewer.settings > > PythonPath "['/srv/code/'] + sys.path" > > </Location> > > > > where syslogviewer is directory created by "django-admin.py > > startproject syslogviewer" run from /srv/code/ directory. > > > > I then run into problems with statements like: > > from models import * > > in views.py of various applications inside the syslogviewer project > > and I had to change it to: > > from syslogviewer.filters.models import * > > to make it work. > > > > Weird is it worked with django-admin.py runserver and not under apache > > +mod_python. Now I'm bit confused about how to make applications > > decoupled from project as for now I have this kind of string hardcoded > > everywhere. > > > > Anyway, thanks for help, very appreciated! > > > > Robert > > > > On Jul 31, 12:25 pm, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > > On Jul 31, 5:24 pm, Giorgio Salluzzo <[EMAIL PROTECTED]> > > > wrote: > > > > > > I know very well this problem because in my company we had the same > > > > some months ago. > > > > > > I investigated a lot also on modpython list and it is a known "bug| > > > > strange behavior", you can find threads really old about it. > > > > > Huh. What bug, strange behaviour inmod_python? What old threads? > > > > > Older versions ofmod_pythondid have some module importing issues but > > > the OP is using latest version. > > > > > Looking again at the original error, the problem possibly turns out to > > > be more subtle. > > > > > What it may come down to is a bad choice of site name. The name they > > > have chosen is 'syslog' which clashes with a standard Python module of > > > the same name. The result of this may be the same as saying: > > > > > >>> import syslog > > > >>> import syslog.settings > > > > > Traceback (most recent call last): > > > File "<stdin>", line 1, in ? > > > ImportError: No module named settings > > > > > Ifmod_pythonhas indirectly caused the standard 'syslog' module to be > > > imported even before sys.pathis adjusted, when Django goes to import > > > 'syslog.settings', Python will see that 'syslog' is already imported > > > and try to import 'settings' as a sub module from the 'syslog'. > > > Problem is it will not exist and 'syslog' isn't a package so it would > > > also fail in attempt to import 'settings' from a package directory for > > > standard 'syslog' module. > > > > > Thus, I'd probably suggest a different name be chosen for the site > > > than 'syslog'. > > > > > > Because of it we changed to the fastest and "problems free" modwsgi. > > > > > In this casemod_wsgimay not have helped. If the recipe in the > > >mod_wsgidocumentation was followed and site parent directory was > > > appended to sys.paththen the standard Python 'syslog' module would > > > again have been found rather that the user package. Same problem would > > > then ensue as standard 'syslog' module doesn't obviously have a > > > submodule called 'settings'. > > > > > Themod_wsgirecipe could be changed to use: > > > > > sys.path.insert(0, "/some/path") > > > > > On still has to be very careful about the name chosen for a site > > > though and reversing the directory search order could cause problems > > > in itself as any code wanting the standard 'syslog' module would now > > > accidentally pick up the site package. > > > > > This raises a general question of whether one should always put > > > additional module directories at the start or end of sys.path. > > > > > It may be worthwhile for the Django documentation to state that one > > > should never choose a site name which clashes with any standard Python > > > module or common third party software. This could be a source of a lot > > > of strange problems otherwise. > > > > > Graham > > > > > >www.modwsgi.org > > > > > > In the wiki page you can find also a Django page. > > > > > > On Jul 30, 3:18 pm,stereoit<[EMAIL PROTECTED]> wrote: > > > > > > > Hi, I'm having problem withmod_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 > followhttp://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 "/"> > > > > > SetHandlermod_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_pythonwith: > > > > > ./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_PYTHONERROR > > > > > > > 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 -~----------~----~----~----~------~----~------~--~---