Published on 2009-06-30 14:23:00+00:00
Python   django   web  

I'd just finished the first version of a new django app (myapp), and so I pushed it out to my development server. All the new code was in place, so I ran python syncdb. The result?

Traceback (most recent call last):  
  File "", line 11, in <module>  
  File "/usr/local/lib/python2.6/site-packages/django/core/management/", line 340, in execute_manager  
  File "/usr/local/lib/python2.6/site-packages/django/core/management/", line 295, in execute  
  File "/usr/local/lib/python2.6/site-packages/django/core/management/", line 192, in run_from_argv  
  File "/usr/local/lib/python2.6/site-packages/django/core/management/", line 210, in execute  
  File "/usr/local/lib/python2.6/site-packages/django/utils/translation/", line 73, in activate  
  File "/usr/local/lib/python2.6/site-packages/django/utils/translation/", line 43, in delayed_loader  
  File "/usr/local/lib/python2.6/site-packages/django/utils/translation/", line 209, in activate  
  File "/usr/local/lib/python2.6/site-packages/django/utils/translation/", line 198, in translation  
  File "/usr/local/lib/python2.6/site-packages/django/utils/translation/", line 181, in _fetch  
AttributeError: 'module' object has no attribute 'myapp'  

What!? I had all the correct files in place, and myapp was listed in my settings' INSTALLED_APPS. I was confused. As it turns out, my PYTHONPATH pointed to my production code (which is actually on the same system, configured for a separate virtual host). So no, it couldn't find my new app because my path said to look in my production code.... :(

So, I just temporarily reset my PYTHONPATH, ran my python syncdb, and I'm rolling for now...