How to load custom packages from inside Django apps into


I am new to Django and have a little problem with making all the project structure clear and organized and so on.. The MVC stuff in Django is quite easy to use when making a small project. However, when I am trying to get a new layer (application logic, like three-tier architecture) between and I have problem to do so.

I have the following structure:

  • mysite/
    • app1/
      • logic/
    • ...

and I want to load into stuff from and How do I do it?

Neither of the following works:

from app1.logic import *

from app1.logic.Class1 import Class1

Also, it would help me if somebody could list me some example of a really huge django project. It looks like either lots of classes and .py files should be in every app folder or everything is in the Both look a little disorganised and I'm sure there is a way to make it a little bit clearer (like in Zend or Symfony).

And, I'm working with Python3 and Django 1.5b2.



If Class1 or parser import from views, then you have a circular dependency. You'll need to move any shared code out into a third file.

You might consider though whether you need all those separate files under logic. In Python there's no requirement to have a class in its own file, so maybe you could have a single instead of a logic directory containing several files.

This video can help you solving your question :)
By: admin