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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:42:21+00:00 2026-06-04T16:42:21+00:00

Without any code changing, my django app started throwing an exception while loading the

  • 0

Without any code changing, my django app started throwing an exception while loading the WSGI script. I’m using django 1.3 with python 2.7, and the top-level .wsgi is essentially unmodified from the default:

import os
import sys

from django.core.handlers.wsgi import WSGIHandler

os.environ['DJANGO_SETTINGS_MODULE'] = 'api.settings'
application = WSGIHandler()

It started producing these errors on any request, as reported by Apache:

mod_wsgi (pid=3283): Target WSGI script '/home/beder/webapps/api/api.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=3283): Exception occurred processing WSGI script '/home/beder/webapps/api/api.wsgi'.
Traceback (most recent call last):
  File "/home/beder/webapps/api/api.wsgi", line 4, in <module>
    from django.core.handlers.wsgi import WSGIHandler
  File "/home/beder/webapps/api/lib/python2.7/django/core/handlers/wsgi.py", line 10, in <module>
    from django import http
  File "/home/beder/webapps/api/lib/python2.7/django/http/__init__.py", line 122, in <module>
    from django.utils.http import cookie_date
  File "/home/beder/webapps/api/lib/python2.7/django/utils/http.py", line 7, in <module>
    from email.Utils import formatdate
  File "/usr/local/lib/python2.7/email/__init__.py", line 79, in __getattr__
    __import__(self.__name__)
  File "/usr/local/lib/python2.7/email/utils.py", line 27, in <module>
    import random
  File "/usr/local/lib/python2.7/random.py", line 47, in <module>
    from os import urandom as _urandom
ImportError: cannot import name urandom

I restarted the server, and it now works normally (no errors). I’m at a loss for what to do – I want to make sure this doesn’t happen again, but it’s not happening now, and I have no idea why that import error appeared.

  • 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-06-04T16:42:23+00:00Added an answer on June 4, 2026 at 4:42 pm

    Are you executing Django inside a virtualenv? Did you updated or upgraded your system? If so and you upgraded to Python 2.7 from Python 2.6 for example you need to regenerate the virtualenv:

    $ virtualenv [your-options] [your-django-project-directory]

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

Sidebar

Related Questions

I have a WCF service and without changing any code on the client side,
I tried this aproach without any success the code I'm using: // File name
Is it possible to create a Line in XAML (without any C# code behind)
I have a code like this: $myvar=$_GET['var']; // a bunch of code without any
I tried without any result. My code looks like this: #include stdafx.h #include <iostream>
I am executing below code successfully without any errors but when I am executing
The following code uploads file to the server display progressdialog with percentage without any
In my Android app I use a TabWidget without any special customization. I'd like
I using the following code for changing Google Calendars Event's location: EventEntry eventEntry =
Is there any example code for something like that (and somehow changing the URL

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.