Problems with forum models creation via syncdb

1 view
Skip to first unread message

bryan.w...@gmail.com

unread,
Jan 22, 2010, 5:08:11 PM1/22/10
to CNProg open discussion
I have been having a difficult time building the database with syncdb
on Python2.5.
I think that some of this issue is because of the use of wildcard* for
importing forum.models it seems to be creating a loop.

>>> import settings
>>> from forum.managers import QuestionManager, TagManager,
AnswerManager, VoteManager, FlaggedItemManager, ReputeManager,
AwardManager
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/username/webapps/username/sousvide_app/forum/
managers.py", line 6, in <module>
from forum.models import *
File "/home/username/webapps/username/sousvide_app/forum/
models.py", line 18, in <module>
from forum.managers import QuestionManager, TagManager,
AnswerManager, VoteManager, FlaggedItemManager, ReputeManager,
AwardManager
ImportError: cannot import name QuestionManager
>>> from forum.models import Question, Tag
>>> from forum.managers import QuestionManager, TagManager,
AnswerManager, VoteManager, FlaggedItemManager, ReputeManager,
AwardManager
>>> import sys, pprint
>>> pprint.pprint(sys.path)
['/home/username/webapps/username/sousvide_app',
'/home/username/webapps/username/lib/python2.5',
'/home/username/lib/python2.5/markdown2-1.0.1.16-py2.5.egg',
'/home/username/lib/python2.5/html5lib-0.11.1-py2.5.egg',
'/home/username/lib/python2.5',
'/usr/local/lib/python25.zip',
'/usr/local/lib/python2.5',
'/usr/local/lib/python2.5/plat-linux2',
'/usr/local/lib/python2.5/lib-tk',
'/usr/local/lib/python2.5/lib-dynload',
'/usr/local/lib/python2.5/site-packages',
'/usr/local/lib/python2.5/site-packages/PIL']
>>> from settings import INSTALLED_APPS
>>> pprint.pprint(INSTALLED_APPS)
('sousvide_app.forum',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.humanize',
'django_authopenid')


I had the same issue on another install that I was able to fix by
explicitly importing the managers from forum.managers .
As you can see, if I load Question and Tag models into the namespace
I'm able to import the managers in the shell.

I made the from forum.models import * explicit:
from forum.models import Question, Tag

However, I'm still not able to syncdb. When I try to output the SQL
the APP can't be found.
$ python2.5 manage.py sql forum
Error: App with label forum could not be found. Are you sure your
INSTALLED_APPS setting is correct?

Can anyone give me an idea what is going wrong?

Reply all
Reply to author
Forward
0 new messages