Forums

local variable 'settings' referenced before assignment

'hi there, I was working on my thesis and my applcaiton was working fine. Now all of a sudden I start receiving the following error.

UnboundLocalError at /
local variable 'settings' referenced before assignment
Request Method: POST
Request URL:    https://moodiraja.pythonanywhere.com/?fb_source=search&ref=br_tf
Django Version: 1.3.7
Exception Type: UnboundLocalError
Exception Value:    
local variable 'settings' referenced before assignment
Exception Location: /usr/local/lib/python2.7/dist-packages/django_facebook/decorators.py in _view, line 42
Python Executable:  /usr/local/bin/uwsgi
Python Version: 2.7.4
Python Path:    
['/var/www',
 '.',
 '',
 '/usr/local/lib/python2.7/dist-packages/setuptools-1.0b2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pip-1.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/DerApproximator-0.51-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/FuncDesigner-0.5115-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/openopt-0.5115-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/setproctitle-1.1.7-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/SpaceFuncs-0.51-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pyhdf-0.8.3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/texcaller-0-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/distribute-0.6.26-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Orange_Text-1.2a1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/Orange/orng',
 '/usr/local/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/pymodules/python2.7',
 u'/home/moodiraja']
Server time:    Thu, 17 Oct 2013 16:56:40 -0500

The error is "local variable 'settings' referenced before assignment".

Have a look at your code -- where is the settings variable? Is there some code path where it can be accessed before it is assigned?