WebFaction
Community site: login faq

One of three of my virtualenv'd Django applications is returning a 500 error this morning, and the logs say this:

[error] [client 127.0.0.1]     import random
[error] [client 127.0.0.1]   File "/usr/local/lib/python2.7/random.py", line 47, in <module>
[error] [client 127.0.0.1]     from os import urandom as _urandom
[error] [client 127.0.0.1] ImportError: cannot import name urandom

I looked around and found this:

http://stackoverflow.com/questions/10776797/error-when-importing-wsgihandler-with-django

and this:

http://mail.python.org/pipermail/python-dev/2012-March/118234.html

but I'm still not sure what to do at the command line to rebuild the environment on web56. Anyone know the formula?

asked 06 Jun '12, 11:17

tanjk
325
accept rate: 0%


We recently did a minor version upgrade of Python2.7 on your server - the error you're seeing is an unanticipated result of that change.

I've just looked through your account, and you're not using a virtualenv anywhere. You should be able to recover from the error simply by restarting your apps' Apache instances to force them to pick up the new Python modules.

Hope that helps, and sorry for the trouble!

permanent link

answered 06 Jun '12, 14:53

seanf
12.2k42136
accept rate: 37%

I misspoke up there -- I have three VirtualHosts out of that Python/Django instance and only one of the three was down.

Of course your solution worked -- thanks once again.

(06 Jun '12, 17:06) tanjk

This error also bit my Django-based site hosted on webfaction. Apache restart fixed it.

I wonder how many other sites are still down because of this...

I'd recommend webfaction notify all users being hosted on upgraded servers about this issue and the fix.

permanent link

answered 17 Jun '12, 18:23

trutane
1
accept rate: 0%

+1 this, just found a test site I had been working on had stopped running. Restart of Apache fixed it too.

(26 Jun '12, 04:05) matt cooper
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×55

question asked: 06 Jun '12, 11:17

question was seen: 7,038 times

last updated: 26 Jun '12, 04:05

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM