Take the 2-minute tour ×

I am using django1.3. in CentOS5. my python version is 2.6 and using the numpy 1.6.1 I used in views.py a function which calculate the regression line. a sample code:

from numpy import *
def test_func(request):
   a=0.8; b=-4
   #add some noise

   #Linear regressison -polyfit - polyfit can be used other orders polys

 return ...

In the browser if I call the page, it cannot load. But it works fine in windows with the default development server which comes with the django. Could anyone tell is there any mistake in the code. or do I miss something? Thanks in advanced.

share|improve this question
<concentrates hard>... No, my psychic vision isn't working, I can't seem to see your error messages. Would you mind posting them here? –  Daniel Roseman Aug 8 '11 at 12:45
If this is server dependent it is not a numpy problem. –  rocksportrocker Aug 8 '11 at 13:49
polyval, polyfit works with the python command line in the server computer(in this case centos). But when I tried to load in the webpage, the browser just continues to load the page, nothing else happen. Its not complaning any error, so I don't know what to do in this case. –  user777177 Aug 9 '11 at 5:55

2 Answers 2

You need to add the WSGIApplicationGroup directive to your httpd.conf file.

<Directory /www/django/apache>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
share|improve this answer

I'm currently investigating a similar issue (Gentoo, Python 2.7, Numpy 1.6.0), and it would seem that only in wsgi, the following numpy code ends up blocking :

eps = np.finfo(float).eps

The help page for finfo says:

For developers of NumPy: do not instantiate this at the module level. The initial calculation of these parameters is expensive and negatively impacts import times. These objects are cached, so calling finfo() repeatedly inside your functions is not a problem.

Not sure what's going on here, but downgrading to Numpy 1.5.1 seems to have solved the issue.

share|improve this answer
When you say WSGI do you mean Apache/mod_wsgi? If so, read code.google.com/p/modwsgi/wiki/… and try overriding the interpreter. –  Graham Dumpleton Aug 20 '11 at 1:55
Thanks for identifying the issues. I also thought that this might be a reason so far but I didn't find anything mentioning about it. I tried my problem without using these functions polyval or polyfit which is a temporary solution perhaps. –  user777177 Aug 20 '11 at 18:20

Your Answer


