Re: mod_python setup on Apache virtual host

2008-12-01 Thread Abe

I just witnessed the same behavior but haven't found the solution.

I'm using Ubuntu 8.04, Django 1.0, and Apache 2.2 with mod_python.

Abe

On Nov 15, 10:16 pm, Chuck22 <[EMAIL PROTECTED]> wrote:
> I did not use ErrorDocument directives in my httpd.config.
>
> Here is my Apache error log:
>
> [Sun Nov 16 03:00:12 2008] [error] [client ] mod_python (pid=3296,
> interpreter='domain.com', phase='PythonHandler',
> handler='django.core.handlers.modpython'): Application error
> [Sun Nov 16 03:00:12 2008] [error] [client ] ServerName: 'domain.com'
> [Sun Nov 16 03:00:12 2008] [error] [client] DocumentRoot: 'C:/Apache/
> homedomain'
> [Sun Nov 16 03:00:12 2008] [error] [client ] URI: '/'
> [Sun Nov 16 03:00:12 2008] [error] [client ] Location: None
> [Sun Nov 16 03:00:12 2008] [error] [client ] Directory: None
> [Sun Nov 16 03:00:12 2008] [error] [client] Filename: 'C:/Apache/
> homedomain/'
> [Sun Nov 16 03:00:12 2008] [error] [client] PathInfo: ''
> [Sun Nov 16 03:00:12 2008] [error] [client ] Traceback (most recent
> call last):
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\Lib\
> \site-packages\\mod_python\\importer.py", line 1537, in HandlerDispatch
> \n    default=default_handler, arg=req, silent=hlist.silent)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\Lib\
> \site-packages\\mod_python\\importer.py", line 1229, in _process_target
> \n    result = _execute_target(config, req, object, arg)
> [Sun Nov 16 03:00:12 2008] [error] [client ]   File "C:\\Python25\\Lib\
> \site-packages\\mod_python\\importer.py", line 1128, in _execute_target
> \n    result = object(arg)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\modpython.py", line 222, in
> handler\n    return ModPythonHandler()(req)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\modpython.py", line 195, in
> __call__\n    response = self.get_response(request)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\base.py", line 128, in
> get_response\n    return self.handle_uncaught_exception(request,
> resolver, exc_info)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\base.py", line 160, in
> handle_uncaught_exception\n    return callback(request, **param_dict)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\views\\defaults.py", line 88, in server_error
> \n    t = loader.get_template(template_name) # You need to create a
> 500.html template.
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\template\\loader.py", line 80, in get_template
> \n    source, origin = find_template_source(template_name)
> [Sun Nov 16 03:00:12 2008] [error] [client ]   File "C:\\Python25\\lib\
> \site-packages\\django\\template\\loader.py", line 73, in
> find_template_source\n    raise TemplateDoesNotExist, name
> [Sun Nov 16 03:00:12 2008] [error] [client ] TemplateDoesNotExist:
> 500.html
>
> It seems an internal applicaiton error - 500 error. But I don't know
> where is the problem. Can you see what's wrong with my Virtual Host
> setup? Or tell me what is the correct way to set up Apache Virtual
> Host for Django.
>
> On Nov 16, 6:12 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:> Are you setting ErrorDocument directives in Apache configuration?
>
> > If you are then disable them and then actual error may not be masked.
>
> > Have you looked in Apache error log for more information?
>
> > Graham
>
> > On Nov 16, 5:53 am, Chuck22 <[EMAIL PROTECTED]> wrote:
>
> > > Here is what I tried.
>
> > > 
> > >     DocumentRoot "C:/Apache/homedomain"
> > >     ServerName domain.com
> > >     ServerAliaswww.domain.com
>
> > >     SetEnv DJANGO_SETTINGS_MODULE homedomain.settings
> > >     SetHandler mod_python
> > >     PythonHandler django.core.handlers.modpython
> > >     PythonPath "['C:/Apache'] + sys.path"
> > >     PythonDebug On
>
> > > 
>
> > > But I got error:
>
> > > ***
> > > MOD_PYTHON ERROR
>
> > > ProcessId:      1708
> > > Interpreter:    'domain.com'
>
> > > ServerName:     'domain.com'
> > > DocumentRoot:   'C:/Apache/homedomain'
>
> > > URI:            '/'
> > > Location:       None
> > > Directory:      None
> > > Filename:       'C:/Apache/homedomain/'
> > > PathInfo:       ''
>
> > > Phase:          'PythonHandler'
> > > Handler:        'django.core.handlers.modpython'
>
> > > Traceback (most recent call last):
>
> > >   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> > > 1537, in HandlerDispatch
> > >     default=default_handler, arg=req, silent=hlist.silent)
>
> > >   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> > > 1229, in _process_target
> > >     result = 

Re: mod_python setup on Apache virtual host

2008-11-18 Thread Chuck22

After adding "homedomain" subdirectory (project root folder) to the
Python path, it is working now.

PythonPath "[r'C:/Apache',r'C:/Apache/homedomain'] + sys.path"

Thank for giving me the right direction.

> Check your Python path to make sure it includes the parent directories
> of everything you import. If that's correct, check that Apache has
> permission to read the necessary files (I have absolutely no idea what
> permission setting/enforcement involves on a Windows system).
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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 setup on Apache virtual host

2008-11-15 Thread Malcolm Tredinnick


On Sat, 2008-11-15 at 21:36 -0800, Chuck22 wrote:
> Because my application works fine with Django development server
> (http://locahost:8000) on the same machine, I assume the problem does
> not reside in my application code. Then it must be due to the
> configuration of Apache.

Presumably that's a reply to my question about why you are suspecting
your VirtualHost configuration? Or is it an answer to something else?

>  Do I need to modify my code to make it work
> with Apache/mod_python?

Not necessarily, but you'll see what the real error is and why Django is
raising it. The error you posted the first time was Django reporting a
different problem (that you're missing a 500.html template). Now that we
can see the real error, it help narrow down whether it's a configuration
issue, or a file permission issue (which could be one difference) or a
database access issue (another difference), etc.

In this case, seeing the error suggests almost immediately what the
problem is likely to be:

> 
> Here is the information after I set DEBUG=True.
> 
> *
> ViewDoesNotExist at /
> Could not import views. Error was: No module named viewsRequest
> Method: GET
> Request URL: http://www.domain.com/
> Exception Type: ViewDoesNotExist
> Exception Value: Could not import views. Error was: No module named
> views
> Exception Location: C:\Python25\lib\site-packages\django\core
> \urlresolvers.py in _get_callback, line 132
> Python Executable: C:\Program Files\Apache Software Foundation
> \Apache2.2\bin\httpd.exe
> Python Version: 2.5.2
> 
> 
> Traceback Switch to copy-and-paste view

See that last line? In future, it will be better to click on that and
use the cut-and-paste view when cutting and pasting. Makes things a lot
easier to read. The view you pasted is good for viewing in a web
browser, but it's obviously a bit verbose for an email message. Not to
worry this time, since you've provided the information needed, but keep
it in mind for the future.

Trimming the next bunch of lines -- since they're important to know, but
in this case just say the problem occurred when trying to resolve the
initial URL -- we get to this:

> Exception Value: Could not import views. Error was: No module named
> views

So it cannot import a particular file. This suggests one of two
problems. Either your Python path isn't set correctly (how to set that
is documented in Django's mod_python documentation) or Apache doesn't
have permission to read the file or one of the directories leading to
the file.

Check your Python path to make sure it includes the parent directories
of everything you import. If that's correct, check that Apache has
permission to read the necessary files (I have absolutely no idea what
permission setting/enforcement involves on a Windows system).

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 setup on Apache virtual host

2008-11-15 Thread Chuck22

Because my application works fine with Django development server
(http://locahost:8000) on the same machine, I assume the problem does
not reside in my application code. Then it must be due to the
configuration of Apache. Do I need to modify my code to make it work
with Apache/mod_python?

Here is the information after I set DEBUG=True.

*
ViewDoesNotExist at /
Could not import views. Error was: No module named viewsRequest
Method: GET
Request URL: http://www.domain.com/
Exception Type: ViewDoesNotExist
Exception Value: Could not import views. Error was: No module named
views
Exception Location: C:\Python25\lib\site-packages\django\core
\urlresolvers.py in _get_callback, line 132
Python Executable: C:\Program Files\Apache Software Foundation
\Apache2.2\bin\httpd.exe
Python Version: 2.5.2


Traceback Switch to copy-and-paste view
C:\Python25\lib\site-packages\django\core\handlers\base.py in
get_response
# Get urlconf from request object, if available.  Otherwise
use default.urlconf = getattr(request, "urlconf",
settings.ROOT_URLCONF)resolver = urlresolvers.RegexURLResolver
(r'^/', urlconf)try:callback, callback_args,
callback_kwargs = resolver.resolve
(request.path_info) ...# Apply view
middlewarefor middleware_method in
self._view_middleware:response = middleware_method
(request, callback, callback_args, callback_kwargs)if
response:return response? Local vars
Variable Value
exc_info (,
ViewDoesNotExist('Could not import views. Error was: No module named
views',), )
exceptions 
middleware_method >
receivers [(, None)]
request ,
POST:, , META:{'AUTH_TYPE': None, 'CONTENT_LENGTH': 0L,
'CONTENT_TYPE': 'httpd/unix-directory', 'GATEWAY_INTERFACE': 'CGI/
1.1', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip,
deflate', ;q=0.5', 'HTTP_CONNECTION': 'Keep-Alive', , 'HTTP_HOST':
'www.domain.com', 'HTTP_IF_MODIFIED_SINCE': 'Sat, 15 Nov 2008 03:40:20
GMT', , 'HTTP_UA_CPU': 'x86', ', 'PATH_INFO': u'/', 'PATH_TRANSLATED':
None, 'QUERY_STRING': None, , 'REMOTE_HOST': None, 'REMOTE_IDENT':
None, 'REMOTE_USER': None, 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '',
'SERVER_NAME': 'domain.com', 'SERVER_PORT': 80, 'SERVER_PROTOCOL':
'HTTP/1.1', 'SERVER_SOFTWARE': 'mod_python'}>
resolver 
response None
self 
settings 
urlconf 'homedomain.urls'
urlresolvers 

C:\Python25\lib\site-packages\django\core\urlresolvers.py in resolve
def resolve(self, path):tried = []match =
self.regex.search(path)if match:new_path = path
[match.end():]for pattern in
self.urlconf_module.urlpatterns:
try:sub_match = pattern.resolve
(new_path) ...except Resolver404,
e:tried.extend([(pattern.regex.pattern + '   ' +
t) for t in e.args[0]['tried']])
else:if sub_match:
sub_match_dict = dict([(smart_str(k), v) for k, v in match.groupdict
().items()])sub_match_dict.update
(self.default_kwargs)? Local vars
Variable Value
match <_sre.SRE_Match object at 0x02140AA0>
new_path u''
path u'/'
pattern 
self 
sub_match None
tried ['^admin/(.*)']

C:\Python25\lib\site-packages\django\core\urlresolvers.py in resolve
if kwargs:args = ()
else:args = match.groups()# In both cases,
pass any extra_kwargs as **kwargs.kwargs.update
(self.default_args)return self.callback, args,
kwargs ...def _get_callback(self):if self._callback is not
None:return self._callbacktry:
self._callback = get_callable(self._callback_str)? Local vars
Variable Value
args ()
kwargs {}
match <_sre.SRE_Match object at 0x022FA330>
path u''
self 

C:\Python25\lib\site-packages\django\core\urlresolvers.py in
_get_callback
def _get_callback(self):if self._callback is not
None:return self._callbacktry:
self._callback = get_callable(self._callback_str)except
ImportError, e:mod_name, _ = get_mod_func
(self._callback_str)raise ViewDoesNotExist, "Could not
import %s. Error was: %s" % (mod_name, str(e)) ...except
AttributeError, e:mod_name, func_name = get_mod_func
(self._callback_str)raise ViewDoesNotExist, "Tried %s in
module %s. Error was: %s" % (func_name, mod_name, str(e))
return self._callbackcallback = property(_get_callback)? Local
vars
Variable Value
_ 'index'
e ImportError('No module named views',)
mod_name 'views'
self 


Environment:

Request Method: GET
Request URL: http://www.domain.com/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'homedomain.product']
Installed Middleware:

Re: mod_python setup on Apache virtual host

2008-11-15 Thread Malcolm Tredinnick


On Sat, 2008-11-15 at 19:16 -0800, Chuck22 wrote:
> I did not use ErrorDocument directives in my httpd.config.
> 
> Here is my Apache error log:
> 
> [Sun Nov 16 03:00:12 2008] [error] [client ] mod_python (pid=3296,
> interpreter='domain.com', phase='PythonHandler',
> handler='django.core.handlers.modpython'): Application error
> [Sun Nov 16 03:00:12 2008] [error] [client ] ServerName: 'domain.com'
> [Sun Nov 16 03:00:12 2008] [error] [client] DocumentRoot: 'C:/Apache/
> homedomain'
> [Sun Nov 16 03:00:12 2008] [error] [client ] URI: '/'
> [Sun Nov 16 03:00:12 2008] [error] [client ] Location: None
> [Sun Nov 16 03:00:12 2008] [error] [client ] Directory: None
> [Sun Nov 16 03:00:12 2008] [error] [client] Filename: 'C:/Apache/
> homedomain/'
> [Sun Nov 16 03:00:12 2008] [error] [client] PathInfo: ''
> [Sun Nov 16 03:00:12 2008] [error] [client ] Traceback (most recent
> call last):
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\Lib\
> \site-packages\\mod_python\\importer.py", line 1537, in HandlerDispatch
> \ndefault=default_handler, arg=req, silent=hlist.silent)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\Lib\
> \site-packages\\mod_python\\importer.py", line 1229, in _process_target
> \nresult = _execute_target(config, req, object, arg)
> [Sun Nov 16 03:00:12 2008] [error] [client ]   File "C:\\Python25\\Lib\
> \site-packages\\mod_python\\importer.py", line 1128, in _execute_target
> \nresult = object(arg)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\modpython.py", line 222, in
> handler\nreturn ModPythonHandler()(req)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\modpython.py", line 195, in
> __call__\nresponse = self.get_response(request)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\base.py", line 128, in
> get_response\nreturn self.handle_uncaught_exception(request,
> resolver, exc_info)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\core\\handlers\\base.py", line 160, in
> handle_uncaught_exception\nreturn callback(request, **param_dict)
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\views\\defaults.py", line 88, in server_error
> \nt = loader.get_template(template_name) # You need to create a
> 500.html template.
> [Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
> \site-packages\\django\\template\\loader.py", line 80, in get_template
> \nsource, origin = find_template_source(template_name)
> [Sun Nov 16 03:00:12 2008] [error] [client ]   File "C:\\Python25\\lib\
> \site-packages\\django\\template\\loader.py", line 73, in
> find_template_source\nraise TemplateDoesNotExist, name
> [Sun Nov 16 03:00:12 2008] [error] [client ] TemplateDoesNotExist:
> 500.html
> 
> 
> It seems an internal applicaiton error - 500 error. But I don't know
> where is the problem. Can you see what's wrong with my Virtual Host
> setup? Or tell me what is the correct way to set up Apache Virtual
> Host for Django.

Why are you assuming this is a problem with your VirtualHost
configuration in apache? We can see from the traceback that Django code
is being run, which means that Apache is correctly handing off
processing of the request to Django and Django isn't able to return a
valid response. So the real question is why is Django raising some kind
of uncaught exception.

One simple way to resolve that is to set DEBUG=True in your settings
file and reload the page, which will then give you a bunch of
information.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 setup on Apache virtual host

2008-11-15 Thread Chuck22

I did not use ErrorDocument directives in my httpd.config.

Here is my Apache error log:

[Sun Nov 16 03:00:12 2008] [error] [client ] mod_python (pid=3296,
interpreter='domain.com', phase='PythonHandler',
handler='django.core.handlers.modpython'): Application error
[Sun Nov 16 03:00:12 2008] [error] [client ] ServerName: 'domain.com'
[Sun Nov 16 03:00:12 2008] [error] [client] DocumentRoot: 'C:/Apache/
homedomain'
[Sun Nov 16 03:00:12 2008] [error] [client ] URI: '/'
[Sun Nov 16 03:00:12 2008] [error] [client ] Location: None
[Sun Nov 16 03:00:12 2008] [error] [client ] Directory: None
[Sun Nov 16 03:00:12 2008] [error] [client] Filename: 'C:/Apache/
homedomain/'
[Sun Nov 16 03:00:12 2008] [error] [client] PathInfo: ''
[Sun Nov 16 03:00:12 2008] [error] [client ] Traceback (most recent
call last):
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\Lib\
\site-packages\\mod_python\\importer.py", line 1537, in HandlerDispatch
\ndefault=default_handler, arg=req, silent=hlist.silent)
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\Lib\
\site-packages\\mod_python\\importer.py", line 1229, in _process_target
\nresult = _execute_target(config, req, object, arg)
[Sun Nov 16 03:00:12 2008] [error] [client ]   File "C:\\Python25\\Lib\
\site-packages\\mod_python\\importer.py", line 1128, in _execute_target
\nresult = object(arg)
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
\site-packages\\django\\core\\handlers\\modpython.py", line 222, in
handler\nreturn ModPythonHandler()(req)
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
\site-packages\\django\\core\\handlers\\modpython.py", line 195, in
__call__\nresponse = self.get_response(request)
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
\site-packages\\django\\core\\handlers\\base.py", line 128, in
get_response\nreturn self.handle_uncaught_exception(request,
resolver, exc_info)
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
\site-packages\\django\\core\\handlers\\base.py", line 160, in
handle_uncaught_exception\nreturn callback(request, **param_dict)
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
\site-packages\\django\\views\\defaults.py", line 88, in server_error
\nt = loader.get_template(template_name) # You need to create a
500.html template.
[Sun Nov 16 03:00:12 2008] [error] [client]   File "C:\\Python25\\lib\
\site-packages\\django\\template\\loader.py", line 80, in get_template
\nsource, origin = find_template_source(template_name)
[Sun Nov 16 03:00:12 2008] [error] [client ]   File "C:\\Python25\\lib\
\site-packages\\django\\template\\loader.py", line 73, in
find_template_source\nraise TemplateDoesNotExist, name
[Sun Nov 16 03:00:12 2008] [error] [client ] TemplateDoesNotExist:
500.html


It seems an internal applicaiton error - 500 error. But I don't know
where is the problem. Can you see what's wrong with my Virtual Host
setup? Or tell me what is the correct way to set up Apache Virtual
Host for Django.



On Nov 16, 6:12 am, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> Are you setting ErrorDocument directives in Apache configuration?
>
> If you are then disable them and then actual error may not be masked.
>
> Have you looked in Apache error log for more information?
>
> Graham
>
> On Nov 16, 5:53 am, Chuck22 <[EMAIL PROTECTED]> wrote:
>
> > Here is what I tried.
>
> > 
> >     DocumentRoot "C:/Apache/homedomain"
> >     ServerName domain.com
> >     ServerAliaswww.domain.com
>
> >     SetEnv DJANGO_SETTINGS_MODULE homedomain.settings
> >     SetHandler mod_python
> >     PythonHandler django.core.handlers.modpython
> >     PythonPath "['C:/Apache'] + sys.path"
> >     PythonDebug On
>
> > 
>
> > But I got error:
>
> > ***
> > MOD_PYTHON ERROR
>
> > ProcessId:      1708
> > Interpreter:    'domain.com'
>
> > ServerName:     'domain.com'
> > DocumentRoot:   'C:/Apache/homedomain'
>
> > URI:            '/'
> > Location:       None
> > Directory:      None
> > Filename:       'C:/Apache/homedomain/'
> > PathInfo:       ''
>
> > Phase:          'PythonHandler'
> > Handler:        'django.core.handlers.modpython'
>
> > Traceback (most recent call last):
>
> >   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> > 1537, in HandlerDispatch
> >     default=default_handler, arg=req, silent=hlist.silent)
>
> >   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> > 1229, in _process_target
> >     result = _execute_target(config, req, object, arg)
>
> >   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> > 1128, in _execute_target
> >     result = object(arg)
>
> >   File "C:\Python25\lib\site-packages\django\core\handlers
> > \modpython.py", line 222, in handler
> >     return ModPythonHandler()(req)
>
> >   File "C:\Python25\lib\site-packages\django\core\handlers
> 

Re: mod_python setup on Apache virtual host

2008-11-15 Thread Graham Dumpleton

Are you setting ErrorDocument directives in Apache configuration?

If you are then disable them and then actual error may not be masked.

Have you looked in Apache error log for more information?

Graham

On Nov 16, 5:53 am, Chuck22 <[EMAIL PROTECTED]> wrote:
> Here is what I tried.
>
> 
>     DocumentRoot "C:/Apache/homedomain"
>     ServerName domain.com
>     ServerAliaswww.domain.com
>
>     SetEnv DJANGO_SETTINGS_MODULE homedomain.settings
>     SetHandler mod_python
>     PythonHandler django.core.handlers.modpython
>     PythonPath "['C:/Apache'] + sys.path"
>     PythonDebug On
>
> 
>
> But I got error:
>
> ***
> MOD_PYTHON ERROR
>
> ProcessId:      1708
> Interpreter:    'domain.com'
>
> ServerName:     'domain.com'
> DocumentRoot:   'C:/Apache/homedomain'
>
> URI:            '/'
> Location:       None
> Directory:      None
> Filename:       'C:/Apache/homedomain/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> 1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
> 1128, in _execute_target
>     result = object(arg)
>
>   File "C:\Python25\lib\site-packages\django\core\handlers
> \modpython.py", line 222, in handler
>     return ModPythonHandler()(req)
>
>   File "C:\Python25\lib\site-packages\django\core\handlers
> \modpython.py", line 195, in __call__
>     response = self.get_response(request)
>
>   File "C:\Python25\lib\site-packages\django\core\handlers\base.py",
> line 128, in get_response
>     return self.handle_uncaught_exception(request, resolver, exc_info)
>
>   File "C:\Python25\lib\site-packages\django\core\handlers\base.py",
> line 160, in handle_uncaught_exception
>     return callback(request, **param_dict)
>
>   File "C:\Python25\lib\site-packages\django\views\defaults.py", line
> 88, in server_error
>     t = loader.get_template(template_name) # You need to create a
> 500.html template.
>
>   File "C:\Python25\lib\site-packages\django\template\loader.py", line
> 80, in get_template
>     source, origin = find_template_source(template_name)
>
>   File "C:\Python25\lib\site-packages\django\template\loader.py", line
> 73, in find_template_source
>     raise TemplateDoesNotExist, name
>
> TemplateDoesNotExist: 500.html
>
> 
>
> I can not find clear answer in the 
> doc:http://docs.djangoproject.com/en/dev/howto/deployment/modpython/
>
> Any helps are welcome.
--~--~-~--~~~---~--~~
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 setup on Apache virtual host

2008-11-15 Thread Chuck22

Here is what I tried.


DocumentRoot "C:/Apache/homedomain"
ServerName domain.com
ServerAlias www.domain.com

SetEnv DJANGO_SETTINGS_MODULE homedomain.settings
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonPath "['C:/Apache'] + sys.path"
PythonDebug On



But I got error:

***
MOD_PYTHON ERROR

ProcessId:  1708
Interpreter:'domain.com'

ServerName: 'domain.com'
DocumentRoot:   'C:/Apache/homedomain'

URI:'/'
Location:   None
Directory:  None
Filename:   'C:/Apache/homedomain/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

Traceback (most recent call last):

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1229, in _process_target
result = _execute_target(config, req, object, arg)

  File "C:\Python25\Lib\site-packages\mod_python\importer.py", line
1128, in _execute_target
result = object(arg)

  File "C:\Python25\lib\site-packages\django\core\handlers
\modpython.py", line 222, in handler
return ModPythonHandler()(req)

  File "C:\Python25\lib\site-packages\django\core\handlers
\modpython.py", line 195, in __call__
response = self.get_response(request)

  File "C:\Python25\lib\site-packages\django\core\handlers\base.py",
line 128, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)

  File "C:\Python25\lib\site-packages\django\core\handlers\base.py",
line 160, in handle_uncaught_exception
return callback(request, **param_dict)

  File "C:\Python25\lib\site-packages\django\views\defaults.py", line
88, in server_error
t = loader.get_template(template_name) # You need to create a
500.html template.

  File "C:\Python25\lib\site-packages\django\template\loader.py", line
80, in get_template
source, origin = find_template_source(template_name)

  File "C:\Python25\lib\site-packages\django\template\loader.py", line
73, in find_template_source
raise TemplateDoesNotExist, name

TemplateDoesNotExist: 500.html




I can not find clear answer in the doc:
http://docs.djangoproject.com/en/dev/howto/deployment/modpython/

Any helps are welcome.
--~--~-~--~~~---~--~~
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 setup on Apache virtual host

2008-11-15 Thread Graham Dumpleton



On Nov 15, 4:14 pm, "Chris Bai" <[EMAIL PROTECTED]> wrote:
> Can anyone point to me a reference to setup mod_python on Apache virtual
> host for Django? Or write something about it?
>
> I am able to run my app in Django development server. I am also able to set
> up virtual host to display index.html for my website. Now I am ready to move
> my Django app to production but don't know how to setup virtual host for it.
> My environment is Apache 2.2.10, mod_python 3.3.1, and Python 2.5.2.

Which part of the online documentation don't you understand?

  http://docs.djangoproject.com/en/dev/howto/deployment/modpython/

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 setup on Apache virtual host

2008-11-14 Thread kaos

I set up Django on windows recently, but I assume you need help with
setting it up in linux? (which i know very little of)

Since you've been using the django development server I assume you
know about basic setup (using 'setup.py install', 'django-admin.py
startproject myproject' and 'manage.py startapp myapp')... if so,
you're almost there.

All you need to do after that is set up apache to handle requests.
Here is what I added to my config. I'm assuming all you have to do is
change the path to a linux style path and it'll work fine.

LoadModule python_module modules/mod_python.so


SetHandler python-program
PythonPath "['E:\WWW\django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonDebug On



SetHandler None



On Nov 15, 6:14 pm, "Chris Bai" <[EMAIL PROTECTED]> wrote:
> Can anyone point to me a reference to setup mod_python on Apache virtual
> host for Django? Or write something about it?
>
> I am able to run my app in Django development server. I am also able to set
> up virtual host to display index.html for my website. Now I am ready to move
> my Django app to production but don't know how to setup virtual host for it.
> My environment is Apache 2.2.10, mod_python 3.3.1, and Python 2.5.2.
--~--~-~--~~~---~--~~
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 setup on Apache virtual host

2008-11-14 Thread Chris Bai
Can anyone point to me a reference to setup mod_python on Apache virtual
host for Django? Or write something about it?

I am able to run my app in Django development server. I am also able to set
up virtual host to display index.html for my website. Now I am ready to move
my Django app to production but don't know how to setup virtual host for it.
My environment is Apache 2.2.10, mod_python 3.3.1, and Python 2.5.2.

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