BeautifulSoup inside Django view makes WSGI timeout -
for strange reason when instantiate beautifulsoup object inside django's view, wsgi timeout. appreciated banging head against wall hours , cannot find root of problem.
the view:
def index(request): soup = beautifulsoup('<b>bold</b>') # removing line solve proble return httpresponse('hello')
the error message in apache log:
[wsgi:error] [pid 4014] [client 127.0.0.1:50892] timeout when reading response headers daemon process 'test.local': /htdocs/test/test/wsgi.py
update: seems bug in beautifulsoup, there no soution.
various third party packages python use c extension modules, , includes scipy, numpy , beautifulsoup, work in python main interpreter , cannot used in sub interpreters mod_wsgi default uses. can find in below link.
http://code.google.com/p/modwsgi/wiki/applicationissues#python_simplified_gil_state_api
you can solve writing below line in conf file.
wsgiapplicationgroup %{global}
if running multiple wsgi applications on same server, want start investigating using daemon mode because frameworks don't allow multiple instances run in same interpreter. case django. use daemon mode each in own process , force each run in main interpreter of respective daemon mode process groups.
Comments
Post a Comment