python - Can someone help clarify my confusion about syncdb and import loops, 'Do you have to be explicit on imports?' -
I have been having difficult time creating a database with syncdb on Python 2.5. I think that some of this problem is due to the use of wildcard * to import some of the forums. The model is making this loop.
& gt; & Gt; & Gt; Import Settings & gt; & Gt; & Gt; In the forum Import the manager from Question Manager, Tag Manager, Answer Manager, Vote Manager, Flagged Entity Manager, Reception Manager, Reward Manager, Traceback (most recent call final): file "console" gt; line 1, & lt; Module & gt; File "/home/username/webapp/username/sousvide_app/forum/managers.py", in line 6, in the & lt; Module & gt; From the stage Model Import * File "/home/username/webapps/username/sousvide_app/forum/models.py", line 18, & lt; Module & gt; In the forum The manager can not import the name of Question Manager, Tag Manager, Answermaker, Vote Manager, Flagged Entity Manager, Reception Manager, Award Manager, Import Errors; & Gt; & Gt; From the stage Model import question, tag & gt; & Gt; & Gt; From the forum Managers are called Question Manager, Tag Manager, North Managers, Vote Manager, Flagged Items Manager, Reptiser, Award Manager and gt; & Gt; & Gt; Importing Systems, Pprint & gt; & Gt; & Gt; Pprint.pprint (sys.path) ['/ home / username / webapps / username / sousvide_app', '/home/username/webapps/username/lib/python2.5', '/home/username/lib/python2.5 / Markdown 2-1.0.1.16-P -2.5.geg, '/ Home / Username / Lib / Python 2.5 / HTML5 Lib-1.1.1.1-PP-2.5.GG,' / Holmes / Username / Lib / Python - 2.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-package / PIL ']> gt; & Gt; & Gt; Settings imported from INSTALLED_APPS & gt; & Gt; & Gt; 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 problem on another problem that I could precisely clear the managers by importing them from the forum. Admin
As you can see, if I load the question and tag model in the namespace, I am able to import managers in the shell.
I made the forum. Import models * Clear: From the forum. Import from forum question, tags
However, I'm still not able to syncdb. When I try to output to SQL, the app can not be found.
$ python2.5 management.py sql forum
Error: App with label forum not found. Are you sure your INSTALLED_APPS settings are correct?
Can someone give me an idea of what is going wrong?
Is there something about Python 2.5 which can contribute to this error?
Do you have global_settings.py
or local_settings.py
will use settings.py
?
The correct way to import Django's settings is to use the decoupled object from the django.conf import settings
, not to import settings
. See the Doctor page about this:
I can not say definitely if your problem has been fixed, but it is a step in the right direction to ensure that your settings are correct If you say your problem is not being displayed in apps INSTALLED_APPS
Comments
Post a Comment