I have a problem with a circular problem:
File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 96, in load_app models = import_module('.models', app_name) File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module __import__(name) File "/Users/......../account/models.py", line 11, in <module> from account import model_managers as model_mgrs File "/Users/......../account/model_managers.py", line 6, in <module> from account import models as account_models ImportError: cannot import name models
I followed this guy's recommendation to deal with circular imports, only by importing the module: https://stackoverflow.com/a/2208778
But I still have a mistake. Now what?
UPDATED
OK, I solved the problem by running in account / model_managers.py:
import importlib account_models = importlib.import_module('.models', 'account')
Although it looks bulky. Not sure if this is pythonic ...
python import circular-dependency
Mave Aug 18 '13 at 6:49 am
source share