Hi,
I am having trouble running Django on Apache 2.  Here is my setup
Debian Testing
Django .91
Apache/2.0.55 (Debian) mod_python/3.1.3 Python/2.3.5

My application is a very simple test application; no models, just 2
urls and one view to handle them.  The application works fine when
using the Django server, but not when using Apache2 and mod_python.

Here is the complete error message:
Mod_python error: "PythonHandler django.core.handlers.modpython"

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
    result = object(req)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/modpython.py",
line 165, in handler
    return ModPythonHandler()(req)

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/modpython.py",
line 135, in __call__
    self.load_middleware()

  File
"/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/handlers/base.py",
line 32, in load_middleware
    raise exceptions.ImproperlyConfigured, 'Middleware module "%s" does
not define a "%s" class' % (mw_module, mw_classname)

ImproperlyConfigured: Middleware module "django.middleware.sessions"
does not define a "SessionMiddleware" class

Here is my apache2 http.conf file:
<Location "/test1/">
   PythonPath "sys.path + ['/var/www/testy']"
   SetHandler mod_python
   PythonHandler  django.core.handlers.modpython
   SetEnv DJANGO_SETTINGS_MODULE testy.settings
   PythonDebug On
</Location>

Here is the settings.py for the project:
# Django settings for testy project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '[EMAIL PROTECTED]'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', 'sqlite3' or
'ado_mssql'.
DATABASE_NAME = ''             # Or path to database file if using
sqlite3.
DATABASE_USER = ''             # Not used with sqlite3.
DATABASE_PASSWORD = ''         # Not used with sqlite3.
DATABASE_HOST = ''             # Set to empty string for localhost. Not
used with sqlite3.
DATABASE_PORT = ''             # Set to empty string for default. Not
used with sqlite3.

# Local time zone for this installation. All choices can be found here:
#
http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com";
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure
to use a
# trailing slash.
# Examples: "http://foo.com/media/";, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'vb3n!a226=fe8$b^ha0_3n5d*c8iii+g+&i5926j&-f1ol20^y'

# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
    'django.core.template.loaders.filesystem.load_template_source',

'django.core.template.loaders.app_directories.load_template_source',
#     'django.core.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
    "django.middleware.common.CommonMiddleware",
    "django.middleware.sessions.SessionMiddleware",
    "django.middleware.doc.XViewMiddleware",
)

ROOT_URLCONF = 'testy.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates".
    # Always use forward slashes, even on Windows.
)

INSTALLED_APPS = (
        'testy.test1',
)


Here is the urls.py:
from django.conf.urls.defaults import *

urlpatterns = patterns('',
    # Example:
    # (r'^testy/', include('testy.apps.foo.urls.foo')),
        (r'^$', 'testy.test1.views.index'),
        (r'^test1/$', 'testy.test1.views.index'),
    # Uncomment this for admin:
#     (r'^admin/', include('django.contrib.admin.urls.admin')),
)

Here is the views.py:
from django.utils.httpwrappers import HttpResponse

def index(request):
    return HttpResponse("Hello, world. This is a test.")


Once again there are no models (taking baby steps just to get this to
work) and this works fine on the test server, but doesn't seem to work
on Apache2 and mod_python.  If you need any other information, just
ask.

Thanks in advance,

Jeff


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

Reply via email to