Hello

I posted this already in django-user. But because it is rather an
internal django/python problem I will repost it here

I experienced a strange behaviour with my django application when I
wanted to deploy and test on my apache instance on my virtual server.
I could successfully deploy my application but when I wanted to access
any view the browser just took forever to load and it never showed the
view. Accessing any non existing view gave the correct debug error
view.

After a long debugging session I could locate the problem to be in
django/middleware/csrf.py. The call which actually took a very long
time was the call to randrange(0, _MAX_CSRF_KEY).

By playing around in a python session it seems that the call to the
system randrange with random.SystemRandom().randrange(0,
_MAX_CSRF_KEY) never stops (or doesn't seem to stop in less than 30
minutes) whereas a call to the "normal" randrange with randrange(0,
_MAX_CSRF_KEY) happily returns the desired random number.
The problem seems to depend on the size of the argument.
random.SystemRandom().randrange happily returns the random values if
the arguments are significantly lower. (I just deleted some number
from the _MAX_CSRF_KEY and then it worked)

I had to manully set the line "randrange = random.randrange" instead
of the if/else logic which checks for the system random generator to
make my app work on my virtual host.

Now it seems that is not a django problem per se. But I am wondering
what I should to with this kind of error as I had to manually fiddle
around in the django-code to be able to successfully host my
application.

In my virtual host I use apache 2.2.15 with python 2.6.5, mod_wsgi 3.2
and django 1.2.1

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to