Tuesday, June 22, 2010

Re: Deploying Django with mod_wsgi

On Jun 23, 2:35 am, commonzenpython <commonzenpyt...@gmail.com> wrote:
> it turns out i have the __init__.py , so i changed the path as you
> suggested but now i get this error :
>
> MOD_PYTHON ERROR
>
> ProcessId:      12182
> Interpreter:    'ashtangayogavideo.com'
>
> ServerName:     'ashtangayogavideo.com'
> DocumentRoot:   '/home/ashtanga/public_html'
>
> URI:            '/ash/'
> Location:       '/ash/'
> Directory:      None
> Filename:       '/home/ashtanga/public_html/ash/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/
> importer.py", line 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/
> importer.py", line 1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File "/usr/local/lib/python2.4/site-packages/mod_python/
> importer.py", line 1128, in _execute_target
>     result = object(arg)
>
>   File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 228, in handler
>     return ModPythonHandler()(req)
>
>   File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 191, in __call__
>     self.load_middleware()
>
>   File "/usr/local/lib/python2.4/site-packages/django/core/handlers/
> base.py", line 33, in load_middleware
>     for middleware_path in settings.MIDDLEWARE_CLASSES:
>
>   File "/usr/local/lib/python2.4/site-packages/django/utils/
> functional.py", line 276, in __getattr__
>     self._setup()
>
>   File "/usr/local/lib/python2.4/site-packages/django/conf/
> __init__.py", line 40, in _setup
>     self._wrapped = Settings(settings_module)
>
>   File "/usr/local/lib/python2.4/site-packages/django/conf/
> __init__.py", line 75, in __init__
>     raise ImportError("Could not import settings '%s' (Is it on
> sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
> e))
>
> ImportError: Could not import settings 'settings' (Is it on sys.path?
> Does it have syntax errors?): No module named settings

The advice is the same as for mod_wsgi, add both paths:

PythonPath "['/home/ashtanga/public_html/', '/home/ashtanga/
public_html/ash'] + sys.path"

Also remove the trailing slash from Location URL and you may as well
put prefix back on settings module.

Thus use:

<Location "/ash">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE ash.settings
PythonOption django.root /ash
PythonDebug On
PythonPath PythonPath "['/home/ashtanga/public_html/', '/home/
ashtanga/public_html/ash'] + sys.path"
</Location>

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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate