Re: mod_python apache2 path problem

2007-08-02 Thread Graham Dumpleton

On Aug 2, 6:11 pm, Giorgio Salluzzo <[EMAIL PROTECTED]>
wrote:
> On Jul 31, 12:25 pm, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
> > Huh. What bug, strange behaviour in mod_python? What old threads?
>
> Excuse me, I tought he was having a problem similar to the 
> following:http://www.modpython.org/pipermail/mod_python/2003-July/013947.html
>
> We had the same and I tried to solve it before deciding to take other
> deployment decisions.

The behaviour exhibited in that post on mod_python list is perfectly
normal for Apache and is just how Apache works. This strangeness of
Apache in the way mod_python handlers works is part of the reason why
SCRIPT_NAME for a WSGI application cannot be automatically determined
by WSGI adapters for mod_python. The only easy way SCRIPT_NAME can be
worked out properly is by doing script determination from a
transhandler. To do such a thing in Python, because all requests for
the virtual server go through Python code, would unnecessarily slow
down request handling. FWIW, because mod_wsgi is all in C code it
doesn't have this problem and can work out SCRIPT_NAME properly by
using a transhandler.

Either way that strangeness should not have been an issue as from
memory Django just uses req.uri directly and is not dependent on
req.filename or req.path_into.

Graham


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



Re: mod_python apache2 path problem

2007-08-02 Thread Giorgio Salluzzo



On Jul 31, 12:25 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:

> Huh. What bug, strange behaviour in mod_python? What old threads?

Excuse me, I tought he was having a problem similar to the following:
http://www.modpython.org/pipermail/mod_python/2003-July/013947.html

We had the same and I tried to solve it before deciding to take other
deployment decisions.


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



Re: mod_python apache2 path problem

2007-08-01 Thread Graham Dumpleton

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:
>
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE syslogviewer.settings
> PythonPath "['/srv/code/'] + sys.path"
> 
>
> 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 "", 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 

Re: mod_python apache2 path problem

2007-07-31 Thread Graham Dumpleton

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 in mod_python? What old threads?

Older versions of mod_python did 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 "", line 1, in ?
ImportError: No module named settings

If mod_python has indirectly caused the standard 'syslog' module to be
imported even before sys.path is 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 case mod_wsgi may not have helped. If the recipe in the
mod_wsgi documentation was followed and site parent directory was
appended to sys.path then 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'.

The mod_wsgi recipe 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 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 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:
>
> > 
> > SetHandler mod_python
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE syslog.settings
> > PythonPath "['/srv/code'] + sys.path"
> > PythonDebug On
> > 
>
> > 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:   

Re: mod_python apache2 path problem

2007-07-31 Thread Giorgio Salluzzo

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.

Because of it we changed to the fastest and "problems free" modwsgi.

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 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 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:
>
> 
> SetHandler mod_python
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE syslog.settings
> PythonPath "['/srv/code'] + sys.path"
> PythonDebug On
> 
>
> 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
-~--~~~~--~~--~--~---



Re: mod_python apache2 path problem

2007-07-30 Thread Graham Dumpleton

On Jul 30, 11: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/

Strictly speaking you shouldn't need to set the above to environment
variables as manage.py will generally do equivalent things for you.

> /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:
>
> 
> SetHandlermod_python
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE syslog.settings
> PythonPath "['/srv/code'] + sys.path"

If you have added to settings.py imports of other modules from your
site package, try:

  PythonPath "['/srv/code','/srv/code/syslog'] + sys.path"

Ie., add both parent and the site directory to path.

Graham

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



Re: mod_python apache2 path problem

2007-07-30 Thread stereoit

Hi, thanks for quick reply.

When I did as suggested I received:

EnvironmentError: Could not import settings 'settings' (Is it on
sys.path? Does it have syntax errors?): No module named settings
<

so I also changed the PythonPath to
PythonPath "['/srv/code/syslog/'] + sys.path"

now I receive:
>
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 29, in load_middleware
mod = __import__(mw_module, {}, {}, [''])

  File "/srv/code/python/lib/python2.4/site-packages/django/contrib/
sessions/middleware.py", line 2, in ?
from django.contrib.sessions.models import Session

  File "/srv/code/python/lib/python2.4/site-packages/django/contrib/
sessions/models.py", line 51, in ?
class Session(models.Model):

  File "/srv/code/python/lib/python2.4/site-packages/django/db/models/
base.py", line 30, in __new__
new_class.add_to_class('_meta', Options(attrs.pop('Meta', None)))

  File "/srv/code/python/lib/python2.4/site-packages/django/db/models/
base.py", line 169, in add_to_class
value.contribute_to_class(cls, name)

  File "/srv/code/python/lib/python2.4/site-packages/django/db/models/
options.py", line 53, in contribute_to_class
setattr(self, 'verbose_name_plural',
meta_attrs.pop('verbose_name_plural', self.verbose_name + 's'))

  File "/srv/code/python/lib/python2.4/site-packages/django/utils/
functional.py", line 42, in __wrapper__
res = self.__func(*self.__args, **self.__kw)

  File "/srv/code/python/lib/python2.4/site-packages/django/utils/
translation/trans_real.py", line 255, in gettext
_default = translation(settings.LANGUAGE_CODE)

  File "/srv/code/python/lib/python2.4/site-packages/django/utils/
translation/trans_real.py", line 184, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)

 File "/srv/code/python/lib/python2.4/site-packages/django/utils/
translation/trans_real.py", line 167, in _fetch
app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]),
appname[p+1:])

AttributeError: 'module' object has no attribute 'frontend'
<

frontend is a folder in the syslog folder created by django-admin.py
startapp frontend.

I still can't figure out why it works on embedded server and not in
apache.

Robert

On Jul 30, 3:36 pm, Anthony DROGON <[EMAIL PROTECTED]>
wrote:
> Hi Robert,
>
> I had quite the same problem, it's been solved by setting
> DJANGO_SETTINGS_MODULE to "settings" instead of "syslog.settings" in
> .
>
> 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.
>


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



Re: mod_python apache2 path problem

2007-07-30 Thread Anthony DROGON

Hi Robert,

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

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:
>
> 
> SetHandler mod_python
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE syslog.settings
> PythonPath "['/srv/code'] + sys.path"
> PythonDebug On
> 
>
>
> 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
-~--~~~~--~~--~--~---



mod_python apache2 path problem

2007-07-30 Thread stereoit

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:


SetHandler mod_python
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE syslog.settings
PythonPath "['/srv/code'] + sys.path"
PythonDebug On



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