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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:06:20+00:00 2026-05-18T05:06:20+00:00

I am having problems setting up wgsi with django. I’m following this http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/ .

  • 0

I am having problems setting up wgsi with django. I’m following this http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/ . Yet I am still really confused as to where to put the .wsgi file and if I need to set the sys.path. I have tried it both directly outside and inside the web root and I can’t get anything to work as expected.

# /home/ben/public_html/django_test/testproject/apache/django.wsgi:

import os
import sys

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

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

Relivant apache conf:

DocumentRoot "/home/ben/public_html/django_test/testproject/"
WSGIScriptAlias / "/home/ben/public_html/django_test/testproject/apache/django.wsgi"

Apache Logs Error (standard apache 500 page):

ImportError: Could not import settings 'testproject.settings' (Is it on sys.path? ...

I can at get django to at least throw an error of it’s own by using this:

import os
import sys

path = '/home/ben/public_html/django_test/testproject'
if path not in sys.path:
    sys.path.append(path)

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

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

which resulted in this django error page:

ImportError at /admin/
No module named testproject.urls
  • 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-18T05:06:21+00:00Added an answer on May 18, 2026 at 5:06 am

    I put the wsgi at same level than settings.py, and looks like this:

    import os
    import sys
    
    sys.path.insert(0,os.sep.join(os.path.abspath(__file__).split(os.sep)[:-2]))
    
    
    os.environ['DJANGO_SETTINGS_MODULE'] = 'yourprojectname.settings'
    
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()
    

    this is the apache conf file:

    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.yourprojectname.com
        Alias /media/ /home/diegueus9/workspace/yourprojectname/media/
    
        <Directory /home/diegueus9/workspace/yourprojectname/media/>
            Order deny,allow
            Allow from all
        </Directory>
    
        WSGIScriptReloading On
        WSGIDaemonProcess yourprojectname 
        WSGIProcessGroup yourprojectname
        WSGIApplicationGroup yourprojectname
        WSGIPassAuthorization On
    
        WSGIScriptAlias / /home/diegueus9/workspace/yourprojectname/yourfile.wsgi
        ErrorLog /var/log/apache2/yourprojectname-error.log
    
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug
    
        CustomLog /var/log/apache2/yourprojectname-access.log combined
    
    </VirtualHost>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when setting up the the notepad exercise ( http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html ) i am having problems
I am having some problems setting up Tomcat for JMX. I added the following
I'm having problems setting a BOOL using @property and @synthesize . I'm using @property
I'm having some beginner problems setting an FFI struct in Ruby. What I want
I'm having real problems with setting up nHibernate with sqlite. Here is the hibernate.cfg.xml
I'm having problems setting the path of the zip file, X, in ZipFile zipfile
I am having a problem setting the Authorize attribute Role value from a variable.
I am in the process of setting up CruiseControl.NET. The problem I am having
Im having problems displaying records to my view when passing viewdata to a user
Im having problems building a query with the linq to sql data query expression

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.