Ask Your Question
1

cannot import other apps' models from writers.py

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

theactiveactor gravatar image theactiveactor
147 7 2 6

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 writers.py 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?

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

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

Evgeny gravatar image Evgeny flag of Chile
11329 50 84 183
http://askbot.org/

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

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 manage.py shell
>>> from myapp import models

Are you trying to modify writers.py 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.

link publish delete flag offensive edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow
1 follower

subscribe to rss feed

Stats

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

Seen: 77 times

Last updated: Aug 06 '10