Hello everybody
I'm new and i want to say Hello to Everybody.
I have problem with Apache. I install python, django, apache,
mod_apache and all what is necessary.
Apache configuration is:
<Location "/mysite/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug Off
#PythonPath "['/', '/mysite', '/var/www'] + sys.path"
PythonPath "['/'] + sys.path"
</Location>
I created an application i root folder:
django-admin.py startproject mysite
and i started development(runserver). All works fine. "Configurations
on your first Django-powered page". Running on apache also works fine.
But when i create Django app:
manage.py startapp inet
views.py:
# Create your views here.
from django.http import HttpResponse
from django.db import connection
from django.conf import settings
from datetime import datetime
def main_page(request):
output = '''
<html>
<head><title>%s</title></head>
<body>
<h1>%s</h1><p>%s</p><h2>%s</h2>
</body>
</html>
''' % (
'1','a','b','c'
)
return HttpResponse(output)
urls.py
from django.conf.urls.defaults import *
from inet.views import *
urlpatterns = patterns('',
(r'^$',main_page),
)
on development server works fine but started on apache i get:
KeyError at /
'HOME'
Request Method: GET
Request URL: http://127.0.0.1/
Exception Type: KeyError
Exception Value:
'HOME'
Exception Location: /usr/lib/python2.5/UserDict.py in __getitem__,
line 22
Python Executable: /usr/bin/python
Python Version: 2.5.4
Python Path: ['/', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-
linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-
dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/
python2.5/site-packages', '/usr/lib/python2.5/site-packages/PIL', '/
usr/lib/python2.5/site-packages/gst-0.10', '/usr/lib/pymodules/
python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/usr/lib/
pymodules/python2.5/gtk-2.0']
Server time: Wed, 9 Dec 2009 11:54:14 -0600
Traceback Switch to copy-and-paste view
* /usr/lib/pymodules/python2.5/django/core/handlers/base.py in
get_response
70.
71. # Get urlconf from request object, if available. Otherwise
use default.
72. urlconf = getattr(request, "urlconf",
settings.ROOT_URLCONF)
73.
74. resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
75. try:
76. callback, callback_args, callback_kwargs = resolver.resolve
(
77. request.path_info) ...
78.
79. # Apply view middleware
80. for middleware_method in self._view_middleware:
81. response = middleware_method(request, callback,
callback_args, callback_kwargs)
82. if response:
83. return response
▶ Local vars
Variable Value
exc_info
(<type 'exceptions.KeyError'>, KeyError('HOME',), <traceback
object at 0x932c57c>)
Can somebody help me? I dont have any ideas how to solve this problem.
Thnask for help!
Regards
Edward9
--
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en.