debugging uwsgi

Robin Becker robin at reportlab.com
Fri Jan 8 10:03:23 EST 2016


I have an unusual bug in a large django project which has appeared when using 
nginx + uwsgi + django. The configuration nginx + flup + django or the django 
runserver don't seem to create the conditions for the error.

Basically I am seeing an error

> Traceback (most recent call last):
> File "./project/fundfacts/api.py", line 33, in refresh_data
> call_command('fe_data_load', month=period_id, datadir=upload_dir)
> File "/home/rptlab/website/quilter.reportlab.com/quilter_2/lib/python2.7/site-packages/django/core/management/__init__.py", line 105, in call_command
> command = load_command_class(app_name, name)
> File "/home/rptlab/website/quilter.reportlab.com/quilter_2/lib/python2.7/site-packages/django/core/management/__init__.py", line 40, in load_command_class
> module = import_module('%s.management.commands.%s' % (app_name, name))
> File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
> __import__(name)
> ImportError: No module named fe_data_load


some hack printouts along the error path seem to indicate that the import should 
be possible as executing

module = import_module('%s.management.commands.%s' % (app_name, 'fe_data_load'))

in the manage.py shell work fine and sys.path looks as expected.

The uwsgi worker process (I'm forking) is corrupted after (or  perhaps because 
of ) this error and causes previously working pages to fail; it looks like the 
python interpreter's gone wrong somehow.

Any good ways forward with debugging this sort of issue? I'm not sure how I 
would remotely debug this using winpdb.
-- 
Robin Becker




More information about the Python-list mailing list