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 4621908
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:46:07+00:00 2026-05-22T02:46:07+00:00

I have been trying to configure mod_wsgi for two days and still no luck.

  • 0

I have been trying to configure mod_wsgi for two days and still no luck. Here is what I did:

  • Create a sample django project mysite. Run python manage.py runserver and make sure it’s working
  • Create apache directory under mysite, create apache_django_wsgi.conf, mysite.wsgi and an empty __init__.py

Content of apache_django_wsgi.conf:

WSGIPythonHome /usr/bin
WSGIRestrictStdout Off
WSGIDaemonProcess django
WSGIProcessGroup django

Alias /site_media/ "/Users/Garth/Dev/web-app/mysite/media/"
<Directory "/Users/Garth/Dev/web-app/mysite/media">
Order allow,deny 
Options Indexes  
Allow from all 
IndexOptions FancyIndexing  
</Directory>  

Alias /media/ "/Library/Python/2.6/site-packages/django/contrib/admin/media/"
<Directory "/Library/Python/2.6/site-packages/django/contrib/admin/media">  
Order allow,deny  
Options Indexes  
Allow from all  
IndexOptions FancyIndexing  
</Directory>  

WSGIScriptAlias /mysite "/Users/Garth/Dev/web-app/mysite/apache/mysite.wsgi"  

<Directory "/Users/Garth/Dev/web-app/mysite/apache">  
Allow from all 
</Directory> 

Content of mysite.wsgi

import os
import sys
sys.path.append('/Users/Garth/Dev/web-app/mysite')
sys.path.append('/Users/Garth/Dev/web-app')

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
  • Download mod_wsgi.so (precompiled binary for Mac OS X) and put it in /usr/libexec/apache2
  • Edit /etc/apache2/httpd.conf,
    add:
    LoadModule wsgi_module libexec/apache2/mod_wsgi.so
    Include /Users/Garth/Dev/web-app/mysite/apache/apache_django_wsgi.conf
  • Run sudo apachectl -k start

If I go to localhost, I can see the files and directories list. But if I go to localhost/mysite (which is the WSGIScriptAlias I configured), I got Internal Server Error.

The error_log of apache is:

[Fri May 13 11:10:38 2011] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri May 13 11:10:38 2011] [notice] Digest: generating secret for digest authentication ...
[Fri May 13 11:10:38 2011] [notice] Digest: done
[Fri May 13 11:10:38 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8l DAV/2 mod_wsgi/3.3 Python/2.6.1 configured -- resuming normal operations
[Fri May 13 11:10:50 2011] [error] [client ::1] mod_wsgi (pid=10921): Target WSGI script '/Users/Garth/Dev/web-app/mysite/apache/mysite.wsgi' cannot be loaded as Python module.
[Fri May 13 11:10:50 2011] [error] [client ::1] mod_wsgi (pid=10921): Exception occurred processing WSGI script '/Users/Garth/Dev/web-app/mysite/apache/mysite.wsgi'.
[Fri May 13 11:10:50 2011] [error] Traceback (most recent call last):
[Fri May 13 11:10:50 2011] [error]   File "/Users/Garth/Dev/web-app/mysite/apache/mysite.wsgi", line 1, in <module>
[Fri May 13 11:10:50 2011] [error]     import os
[Fri May 13 11:10:50 2011] [error] ImportError: No module named os

Does anyone see where goes wrong? The error_log seems to tell a lot. I’m new to web development, and I might have made some obvious mistakes. Thank you very much!

  • 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-22T02:46:08+00:00Added an answer on May 22, 2026 at 2:46 am

    Don’t set WSGIPythonHome for a start it isn’t needed. It should only be needed in certain situations and this isn’t one of them.

    In this case you have set it to a wrong value. By rights the fact it is wrong shouldn’t have caused a problem as Python should have fallen back to using correct default value, but it may not do that for some reason.

    You can also delete the line:

    WSGIRestrictStdout Off
    

    as that isn’t needed for mod_wsgi 3.3.

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

Sidebar

Related Questions

I have been trying to configure Gradle to manage a Grails project for a
I have been trying for almost a week now to create an SQLite database
I have been trying to create a ListView which I can sort using drag
I have been trying to run configure to prepare the make file for GTK
I have been trying to set up OpenCV for the past few days with
I have been trying to configure Windsor to provide a different implementation for a
Hi I have been trying to properly configure IIS 6 to give write permisiosn
I have been trying to configure my apache server to support virtual hosts, these
I have been trying to follow this example from propel to configure a custom
I have been playing around with tableviews for the past few days trying to

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.