On 23 June 2010 13:08, commonzenpython <[email protected]> wrote:
> Hi, im trying to deploy django with mod_wsgi but i keep getting a
> SERVER INTERNAL ERROR and a 404
>
> this is what i added to my httpd.conf:
>
> LoadModule wsgi_module modules/mod_wsgi.so
>
> WSGIScriptAlias /ash /home/ashtanga/public_html/ash/apache/django.wsgi
> <Directory /home/ashtanga/public_html/ash>
As I said before on Django list, this could be more secure and use:
<Directory /home/ashtanga/public_html/ash/apache>
Ie., allow only access to 'apache' subdirectory.
Not relevant to problem though.
> Order deny,allow
> Allow from all
> </Directory>
>
> my wsgi file path is /ash /home/ashtanga/public_html/ash/apache/
> django.wsgi
> my project path is /home/ashtanga/public_html/ash , inside my project
> is my views, urls, and settings. Inside my views i have :
>
> from django.http import HttpResponse
>
> def hello(request):
> return HttpResponse("Hello world")
>
> and inside my urls i have :
>
> from django.conf.urls.defaults import *
> from mysite.views import hello
>
> urlpatterns = patterns('',
> ('^hello/$', hello),
> )
But what URL are you using to access it?
> django.wsgi has the following:
>
> import os
> import sys
>
> sys.path.append('/home/ashtanga/public_html')
> sys.path.append('/home/ashtanga/public_html/ash')
> os.environ['DJANGO_SETTINGS_MODULE'] = 'ash.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
>
> this is the error i get in the apache error log:
>
>
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] mod_wsgi
> (pid=30521): Exception occurred processing WSGI script '/home/ashtanga/
> public_html/ash/apache/django.wsgi'.
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] Traceback
> (most recent call last):
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File "/usr/
> local/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line
> 241, in __call__
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] response
> = self.get_response(request)
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File "/usr/
> local/lib/python2.4/site-packages/django/core/handlers/base.py", line
> 142, in get_response
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] return
> self.handle_uncaught_exception(request, resolver, exc_info)
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File "/usr/
> local/lib/python2.4/site-packages/django/core/handlers/base.py", line
> 181, in handle_uncaught_exception
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] return
> callback(request, **param_dict)
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File "/usr/
> local/lib/python2.4/site-packages/django/views/defaults.py", line 23,
> in server_error
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] t =
> loader.get_template(template_name) # You need to create a 500.html
> template.
You need to fix this by providing a 500.html template as specified in
the Django documentation. See:
http://docs.djangoproject.com/en/dev/intro/tutorial03/
The lack of a 500.html template results in Django throwing a 404 error
instead at which Apache starts getting confused.
As explained in the documentation, if you also instead set DEBUG to
True, then Django will behave a bit differently and display certain
error information in the browser instead as to what you underlying
error it.
Graham
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File "/usr/
> local/lib/python2.4/site-packages/django/template/loader.py", line
> 157, in get_template
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129]
> template, origin = find_template(template_name)
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File "/usr/
> local/lib/python2.4/site-packages/django/template/loader.py", line
> 138, in find_template
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] raise
> TemplateDoesNotExist(name)
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129]
> TemplateDoesNotExist: 500.html
> [Tue Jun 22 21:55:56 2010] [error] [client 173.7.120.129] File does
> not exist: /home/ashtanga/public_html/500.shtml
> [Tue Jun 22 22:55:57 2010] [error] [client 173.7.120.129] File does
> not exist: /home/ashtanga/public_html/favicon.ico
> [Tue Jun 22 22:55:57 2010] [error] [client 173.7.120.129] File does
> not exist: /home/ashtanga/public_html/404.shtml
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/modwsgi?hl=en.