Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7562437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:24:26+00:00 2026-05-30T13:24:26+00:00

I’m trying to run a local Django server on Apache with mod_wsgi. I am

  • 0

I’m trying to run a local Django server on Apache with mod_wsgi. I am running the out-of-the-box Apache on Mac.

hobbes3@hobbes3:~/Sites/mysite$ apachectl -v
Server version: Apache/2.2.21 (Unix)
Server built:   Nov 15 2011 15:12:57

Apache properly loads mod_wsgi.

hobbes3@hobbes3:~/Sites/mysite$ apachectl -M | grep wsgi
Syntax OK
wsgi_module (shared)

In my httpd.conf file I load apache_django_wsgi.conf which is

WSGIDaemonProcess django
WSGIProcessGroup django
WSGIPythonHome /usr/local/Cellar/python/2.7.2/

Alias /mysite/ "/Users/hobbes3/Sites/mysite/"
<Directory "/Users/hobbes3/Sites/mysite">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>

WSGIScriptAlias /mysite "/Users/hobbes3/Sites/mysite/apache/django.wsgi"

<Directory "/Users/hobbes3/Sites/mysite/apache">
Allow from all
</Directory>

My django.wsgi file is

import os
import sys

paths = [ '/Users/hobbes3/Sites/mysite',
          '/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages',
]

for path in paths:
    if path not in sys.path:
        sys.path.append(path)

sys.executable = '/usr/local/bin/python'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I can also restart Apache without any error. But when I try to visit http://localhost/mysite, the browser just shows the index of my page. At the bottom of the page, it says Apache/2.2.21 (Unix) DAV/2 mod_wsgi/3.3 Python/2.7.2 PHP/5.3.8 with Suhosin-Patch Server at localhost Port 80.

Before it used to say something about unable to load MySQLdb, but now it doesn’t show any errors. But I still can’t see my Django site. Here is the previous error (I truncated the dates and times):

mod_wsgi (pid=74739): Exception occurred processing WSGI script '/Users/hobbes3/Sites/mysite/apache/django.wsgi'.
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 272, in __call__
    response = self.get_response(request)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/views/debug.py", line 59, in technical_500_response
    html = reporter.get_traceback_html()
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/views/debug.py", line 151, in get_traceback_html
    return t.render(c)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/base.py", line 123, in render
    return self._render(context)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/base.py", line 117, in _render
    return self.nodelist.render(context)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/base.py", line 744, in render
    bits.append(self.render_node(node, context))
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/debug.py", line 73, in render_node
    result = node.render(context)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/debug.py", line 90, in render
    output = self.filter_expression.resolve(context)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/base.py", line 536, in resolve
    new_obj = func(obj, *arg_vals)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/template/defaultfilters.py", line 695, in date
    return format(value, arg)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/dateformat.py", line 285, in format
    return df.format(format_string)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
    pieces.append(force_unicode(getattr(self, piece)()))
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/dateformat.py", line 191, in r
    return self.format('D, j M Y H:i:s O')
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
    pieces.append(force_unicode(getattr(self, piece)()))
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/encoding.py", line 71, in force_unicode
    s = unicode(s)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/functional.py", line 206, in __unicode_cast
    return self.__func(*self.__args, **self.__kw)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 81, in ugettext
    return _trans.ugettext(message)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 286, in ugettext
    return do_translate(message, 'ugettext')
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 276, in do_translate
    _default = translation(settings.LANGUAGE_CODE)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 185, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
    app = import_module(appname)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 3, in <module>
    from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/contrib/admin/helpers.py", line 3, in <module>
    from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/contrib/admin/util.py", line 1, in <module>
    from django.db import models
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/db/utils.py", line 33, in load_backend
    return import_module('.base', backend_name)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
TemplateSyntaxError: Caught ImproperlyConfigured while rendering: Error loading MySQLdb module: dlopen(/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.4-x86_64.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.4-x86_64.egg/_mysql.so
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:24:27+00:00Added an answer on May 30, 2026 at 1:24 pm

    You’ve got both an Alias and a WSGIScriptAlias for mysite. I’d guess that the first Alias is taking precedence, so Apache is serving a directory listing rather than delegating to mod_wsgi.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.