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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:10:10+00:00 2026-05-15T11:10:10+00:00

I am trying to get my Django project running on the production server. I

  • 0

I am trying to get my Django project running on the production server.

I setup the environment using pip, so it is identical to the development environment where everything is running fine. The only difference is that I don’t use virtualenv on production, because this project is the only one that is going to run on production. Also on production, there is an Nginx reverse proxy to serve static content, and passes dynamic requests to Apache2.

The Apache wsgi file is as follows:

import sys, os

sys.path.append('/home/project/src')

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

When I access the server, I get an import error:

ImproperlyConfigured: Error importing middleware middleware: "cannot import name UserProfile"

Which refers to the middleware.py under src/ folder which is referred by the settings. But I can import both the middleware and the UserProfile class from within ./manage.py shell prompt.

It seems like a problem with paths in wsgi file but I cannot see what. The directory structure is:

/home/project
/home/project/src (which contains the settings.py, middleware.py and app folders)
/home/apache/apache.wsgi

Any help is greatly appreciated.

Thanks,
oMat

  • 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-15T11:10:10+00:00Added an answer on May 15, 2026 at 11:10 am

    Ensure all directories/files are readable by others so that Apache user can access them, unless that is you are running daemon mode with different user in case that user has to be able to read them. Also read:

    http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use-with.html

    It may not help, but the WSGI script file contents described at end of that will ensure process environment is setup closer to what Django development server does in case it is related to those differences.

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

Sidebar

Related Questions

I am using Python 2.7 and trying to get a Django project running on
I'm trying to get Django running on GAE using this tutorial . When I
I am trying to setup an APE server for my Django project. Setup I
I'm running CentOS 5, and am trying to get a django application working with
I am trying to debug my Django project via Eclipse. The app works fine
I'm trying to get a django project set up, and I seem to be
I have been trying to get xapian working django haystack for a project im
I am trying to setup a Django project like explained on AlwaysData , but
I'm trying to get django running on my dreahost account. I've been trying to
I've got a django project working on a development server(ubuntu) that we have been

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.