First time here? Check out the FAQ!

cannot import other apps' models from

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?

theactiveactor's avatar
asked 2010-07-24 21:22:13 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


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.

Evgeny's avatar
updated 2010-07-24 22:13:26 -0500, answered 2010-07-24 21:49:07 -0500
edit flag offensive 0 remove flag delete link


add a comment see more comments