Ask Your Question

cannot import other apps' models from

asked 2010-07-24 21:22:13 -0600

theactiveactor gravatar image

I have an app whose models and views resides in my site's project directory (in contrast to askbot, which resides in /usr/lib/...). When I try import its models from an askbot's as follows:

from myapp import models

I get this error:

ImproperlyConfigured: Error importing middleware askbot.middleware.view_log: "cannot import name models"

Any hints on what may be causing this error or how to debug it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2010-07-24 21:49:07 -0600

Evgeny gravatar image

updated 2010-07-24 22:13:26 -0600

Hi again. The error sounds to me like a circular dependency issue (a importing b and b importing a at the same time), but I may be wrong...

This can even be unrelated to askbot - does import statement succeed on its own?

You can try this:

python shell
>>> from myapp import models

Are you trying to modify by adding the statement

from myapp import models

? And your copy of askbot is installed into /usr/lib... If so, then I recommend to keep askbot in your user space - it certainly does not have to be in /usr/lib - because it is more convinient to edit in directory where you have normal write permissions.

The only reason askbot goes into /usr/lib/ is to allow multisite deployments.

With your setup you can just recursively copy contents of /askbot/ directory wherever it's installed to your project directory.

If you plan to modify askbot source code then you'll save yourlself a lot of trouble if you add it to your git repository. That way you will be able to easily pull upgrades. Of course it's best to keep applications decoupled as much as possible. Maybe we can together think of some orderly way to build extensions...

Use pylint - I like it a lot - helps me catch so many errors do you debug less.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2010-07-24 21:22:13 -0600

Seen: 121 times

Last updated: Aug 06 '10